submission_id
stringlengths 10
10
| problem_id
stringlengths 6
6
| language
stringclasses 3
values | code
stringlengths 1
522k
| compiler_output
stringlengths 43
10.2k
|
|---|---|---|---|---|
s480360850
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
string s;
long long bt(int x, long long sum) {
if (x == s.size())
return sum;
long long ret = 0;
for (int i = x + 1; i <= s.size(); i++)
ret += bt(i, stoll(s.substr(x, i - x)) + sum);
return ret;
}
int main() {
cin >> s;
cout << bt(0, 0) << "\n;
return 0;
}
|
a.cc:18:29: warning: missing terminating " character
18 | cout << bt(0, 0) << "\n;
| ^
a.cc:18:29: error: missing terminating " character
18 | cout << bt(0, 0) << "\n;
| ^~~~
a.cc: In function 'int main()':
a.cc:19:9: error: expected primary-expression before 'return'
19 | return 0;
| ^~~~~~
|
s699311302
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
typedef long long ll;
int main(){
char s[12345];
scanf("%s", s);
int len = strlen(s);
ll ans = 0;
// 2^(len-1) 回す
for(int t = 0; t < (1<<(len-1)); t++){
ll num = s[0] - '0'; //先頭の文字を数字に変換
for(int i=0;i<len-1;i++){
// i bit目が立ってた時+が入る
// 立っていなかったら10倍して次の数字が加えられる
if( t & (1 << i)){
ans += num;
num = 0;
}
num = num * 10 + s[i+1] - '0';
}
ans += num;
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:11:15: error: 'strlen' was not declared in this scope
11 | int len = strlen(s);
| ^~~~~~
a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<cstdio>
+++ |+#include <cstring>
4 | using namespace std;
|
s714658524
|
p04001
|
C++
|
どこで間違えてるか分からない
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <cstdio>
using namespace std;
template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;
using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using ch = char;
using vll = V<ll>;
using vvll = V<V<ll>>;
using vvvll = V<V<V<ll>>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vvpll = V<vpll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<ch>;
using vvch = V<vch>;
using dqll = deque<ll>;
using vdqll = V<dqll>;
using pqll = priority_queue<ll>;
using vpqll = V<pqll>;
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define ba back()
#define fr front()
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,n) substr(a,n)
#define cfs(a) cout<<fixed<<setprecision(a) //
/*vvll v(n,vll(m)) n行m列 continue
A.erase(A.begin()+i); 配列Aのi番目を消せる
std::binary_search(v.bgn,v.en,a); 二分探索
abs(a,b) pow(a,n) to_string stoll
auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aとなる初のv[i]
v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる
lower upper co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi
vvll v(100001,vll(0)); v[a].pb(b); v[b].pb(a);
pqll pq; pq.push(ai); pq.top(); pq.pop();
priority_queue<ll,vll,greater<ll>> pqg; 昇順
vdqll dq(3); dq[0].pb(1); dq[0].pb(2); dq[0].pf(0);
dq[0].fr→0 dq[0].ba→1 dq[0].pof; dq[0].fr→1
que.sz while(!que.empty())
ll a=1,b=2,c=4,xo; xo=a^b^c; if(a^b^c==0)co(xo)→7 if(xo==0)co(xo)→なし
*/
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
#define comuse Comuse()
ll combi(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll pow_mod(ll a,ll n,ll mod){
ll res=1; //n=k_2 pow(a,k_2)
for(;n>0;n/=2){ //ex,pow(a,1011_2)=a^8*a^2*a^1
if(n%2==1)res=(res*a)%mod;
a=(a*a)%mod;
}
return res;
}
ll digit_sum(ll n) {
ll m=0;
FOR(i,0,20){
m+=n%10;
n/=10;
if(n==0)break;
}
return m;
}
ll lcm(ll a,ll b){
ll n;
n=a/gcd(a,b)*b;
return n;
}
ll rec(str s,ll c){
//cout<<s<<" ";
ll n=s.sz;
ll res=0;
if(n==1){
//co("x");
res=stoll(s)*pow(2,c-1);
}
if(n>1){
FOR(i,1,n+1){
if(c-1<0&&n-1-i<0){
//co("y1");
res+=stoll(s.subs(0,i))*pow(2,0)
*pow(2,0)+rec(s.subs(i,n-i),c+1);
}
else if(c-1<0){
//co("y2");
res+=stoll(s.subs(0,i))*pow(2,n-1-i)
*pow(2,0)+rec(s.subs(i,n),c+1);
}
else if(n-1-i<0){
//co("y3");
res+=stoll(s.subs(0,i))*pow(2,0)
*pow(2,c-1)+rec(s.subs(i,n),c+1);
}
else{
//co("y4");
res+=stoll(s.subs(0,i))*pow(2,n-1-i)
*pow(2,c-1)+rec(s.subs(i,n),c+1);
}
}
}
//else co("z");
//co(s<<" "<<res);
return res;
}
int main(){
str s;
cin>>s;
//co(s.subs(1,3));
co(rec(s,0));
}
|
a.cc:1:1: error: '\U00003069\U00003053\U00003067\U00009593\U00009055\U00003048\U00003066\U0000308b\U0000304b\U00005206\U0000304b\U00003089\U0000306a\U00003044' does not name a type
1 | どこで間違えてるか分からない
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope; did you mean 'en'?
2176 | unsigned char __data[_Len];
| ^~~~
| en
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope; did you mean 'en'?
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
| en
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope; did you mean 'en'?
2202 | unsigned char __data[_Len];
| ^~~~
| en
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
|
|
s729863185
|
p04001
|
C++
|
+の入った文字列が作れない
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#include <queue>
#include <cstdio>
using namespace std;
template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;
using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using ch = char;
using vll = V<ll>;
using vvll = V<V<ll>>;
using vvvll = V<V<V<ll>>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vvpll = V<vpll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<ch>;
using vvch = V<vch>;
using dqll = deque<ll>;
using vdqll = V<dqll>;
using pqll = priority_queue<ll>;
using vpqll = V<pqll>;
#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define ba back()
#define fr front()
#define pob pop_back()
#define pof pop_front()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a) //
/*vvll v(n,vll(m)) n行m列 continue
A.erase(A.begin()+i); 配列Aのi番目を消せる
std::binary_search(v.bgn,v.en,a); 二分探索
abs(a,b) pow(a,n) to_string stoll
auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aとなる初のv[i]
v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる
lower upper co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi
vvll v(100001,vll(0)); v[a].pb(b); v[b].pb(a);
pqll pq; pq.push(ai); pq.top(); pq.pop();
priority_queue<ll,vll,greater<ll>> pqg; 昇順
vdqll dq(3); dq[0].pb(1); dq[0].pb(2); dq[0].pf(0);
dq[0].fr→0 dq[0].ba→1 dq[0].pof; dq[0].fr→1
que.sz while(!que.empty())
ll a=1,b=2,c=4,xo; xo=a^b^c; if(a^b^c==0)co(xo)→7 if(xo==0)co(xo)→なし
*/
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
#define comuse Comuse()
ll combi(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll pow_mod(ll a,ll n,ll mod){
ll res=1; //n=k_2 pow(a,k_2)
for(;n>0;n/=2){ //ex,pow(a,1011_2)=a^8*a^2*a^1
if(n%2==1)res=(res*a)%mod;
a=(a*a)%mod;
}
return res;
}
ll digit_sum(ll n) {
ll m=0;
FOR(i,0,20){
m+=n%10;
n/=10;
if(n==0)break;
}
return m;
}
ll lcm(ll a,ll b){
ll n;
n=a/gcd(a,b)*b;
return n;
}
int main(){
str st;
cin>>st;
str s[512];
ll n=st.sz;
ll m=pow(2,n-1);
ll k=0;
FOR(i,0,m){
s[i]=st[n-1];
k=i;
for(ll j=n-2;j>=0;j--){
if(k%2==1){
s[i]=st[j]+"+"+s[i];
}
else{
s[i]=st[j]+s[i];
}
k/2;
}
}
}
|
a.cc:1:1: error: expected unqualified-id before '+' token
1 | +の入った文字列が作れない
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope; did you mean 'en'?
2176 | unsigned char __data[_Len];
| ^~~~
| en
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope; did you mean 'en'?
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
| en
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope; did you mean 'en'?
2202 | unsigned char __data[_Len];
| ^~~~
| en
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
|
s971518879
|
p04001
|
C++
|
s = ""
def rec(i, word):
if i == len(s):
return eval("".join(word))
ans = 0
word.append('+')
word.append(s[i])
ans += rec(i+1, word)
word.pop()
word.pop()
word.append(s[i])
ans += rec(i+1, word)
word.pop()
return ans
def main():
global s
s = input()
print(rec(1, [s[0]]))
if __name__ == '__main__':
main()
|
a.cc:22:16: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
22 | if __name__ == '__main__':
| ^~~~~~~~~~
a.cc:1:1: error: 's' does not name a type
1 | s = ""
| ^
|
s003214124
|
p04001
|
C++
|
//In The Name Of GOD
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int mod = 1000000007;
const int inf = 2000000000;
const int maxn = 500*1000+500*1000+15;
const int MLOG = 18;
#define pb push_back
#define pp pop_back
#define X first
#define Y second
#define IO ios_base::sync_with_stdio(false);
#define sz(a) (int)(a.size())
vector<char> vec;
void faz1(vector<char> &vec){
if ( vec.back() == 'd' ){
if( sz(vec) >= 5 ){
if( vec[sz(vec) - 2] == 'r' && vec[sz(vec) - 3] == 'e' && vec[sz(vec) - 4] == 'a' && vec[sz(vec) - 5] == 'm'){
for(int i = 0;i < 5 ; i++)
vec.pp();
}else{
cout << "NO";
exit(0);
}
}else{
cout << "NO";
exit(0);
}
}else if( vec.back() == 'e' ){
if( sz(vec) >= 5 ){
if( vec[sz(vec) - 2] == 'r' && vec[sz(vec) - 3] == 'a' && vec[sz(vec) - 4] == 's' && vec[sz(vec) - 5] == 'e'){
for(int i = 0;i < 5 ; i++)
vec.pp();
}else{
cout << "NO";
exit(0);
}
}else{
cout << "NO";
exit(0);
}
}else{
cout<< "NO";
exit(0);
}
}
void faz3(vector<char> &vec){
if( sz(vec) == 0 )
return ;
if ( vec[sz(vec)-1] == 'r'){
vec.pp();
}else{
return ;
}
}
void faz2(vector<char> &vec){
if( sz(vec) == 0 )
return ;
if( sz(vec) == 1 ){
cout << "NO";
exit(0);
return ;
}
if ( vec.back() == 'e' && vec[sz(vec)-2] == 'r'){
}else{
cout<<"NO";
exit(0);
}
if(sz(vec) == 2){vec.pp();vec.pp();return ;}
if(vec[sz(vec) - 3] == 'a'){
return;
}
vec.pp();
vec.pp();
return ;
}
int main(){
string s;
cin >> s;
reverse(s.begin, s.end());
int i=0;
string ss[4]={"dream","dreamer","erase","eraser"};
for(int i = 0; i < 4; i++){
reverse(ALL(ss[i]));
}
string t = "";
while(i < s.size()){
t += s[i];
for(int i = 0; i < 4; i++){
if(ss[i] == t){
t="";
}
}
i++;
}
if(tmp==""){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
return 0;
}
|
a.cc: In function 'int main()':
a.cc:93:12: error: no matching function for call to 'reverse(<unresolved overloaded function type>, std::__cxx11::basic_string<char>::iterator)'
93 | reverse(s.begin, s.end());
| ~~~~~~~^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'void std::reverse(_BIter, _BIter) [with _BIter = __gnu_cxx::__normal_iterator<char*, __cxx11::basic_string<char> >]'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
a.cc:97:17: error: 'ALL' was not declared in this scope
97 | reverse(ALL(ss[i]));
| ^~~
a.cc:109:8: error: 'tmp' was not declared in this scope; did you mean 'tm'?
109 | if(tmp==""){
| ^~~
| tm
|
s775164062
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string ST; cin >> ST;
vector<int> S;
int n = ST.sinze();
long long ans;
for(int i=0; i<n; i++){
S[i]= ST[i] - '0';
}
for(int bit=0; bit < (1 << n-1) ; bit++){
int jud = S[0];
for(int i=0; i<n-1; i++){
if(bit & (1 << i)){
ans += jud;
jud = S[i+1];
}
else {
jud = jud * 10 + S[i + 1];
}
}
}
ans += jud;
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:7:14: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'sinze'; did you mean 'size'?
7 | int n = ST.sinze();
| ^~~~~
| size
a.cc:27:10: error: 'jud' was not declared in this scope
27 | ans += jud;
| ^~~
|
s939137231
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int search(int s){
int count=0;
while (s!=0){
count++;
s /= 10;
}
return count;
}
int mult(int i,int s){
int count=search(s),x=1;
int ans=i*pow(10,count);
if (count>1){
for (int j=1;j<=pow(2,count-1);j*2){
ans += i*pow(10,count-x);
x--;
}
}
return ans;
}
//iは最上位数
int sum(int i,int s){
int count = search(s);
if (i==0){
return s;
}
int result =0;
if (count==1){
return i*pow(2,count) + mult(i,s) +2*sum(0,s);
}
else{
return i*pow(2,count) + mult(i,s) +2*sum(s/pow(10,count-1),s%pow(10,count-1));
}
}
int main(){
int num,count;
cin>>num;
count=search(num);
int i=num/pow(10,count),s=num%pow(10,count);
cout<<sum(i,s)<<endl;
}
|
a.cc: In function 'int sum(int, int)':
a.cc:37:65: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
37 | return i*pow(2,count) + mult(i,s) +2*sum(s/pow(10,count-1),s%pow(10,count-1));
| ~^~~~~~~~~~~~~~~~
| | |
| int __gnu_cxx::__promote<double>::__type {aka double}
a.cc: In function 'int main()':
a.cc:45:32: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
45 | int i=num/pow(10,count),s=num%pow(10,count);
| ~~~^~~~~~~~~~~~~~
| | |
| int __gnu_cxx::__promote<double>::__type {aka double}
|
s172283909
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + int(S[i]-'0');
adding_S = adding_S + S[i];
if(i==0) sum = sum + int(adding_S - '0');
else sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + int(S[j]-'0');
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:18:42: error: no match for 'operator-' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'char')
18 | if(i==0) sum = sum + int(adding_S - '0');
| ~~~~~~~~ ^ ~~~
| | |
| | char
| std::string {aka std::__cxx11::basic_string<char>}
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
618 | operator-(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:618:5: note: template argument deduction/substitution failed:
a.cc:18:44: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::reverse_iterator<_Iterator>'
18 | if(i==0) sum = sum + int(adding_S - '0');
| ^~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1790 | operator-(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1790:5: note: template argument deduction/substitution failed:
a.cc:18:44: note: 'std::string' {aka 'std::__cxx11::basic_string<char>'} is not derived from 'const std::move_iterator<_IteratorL>'
18 | if(i==0) sum = sum + int(adding_S - '0');
| ^~~
|
s264914198
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + int(S[i]-'0');
adding_S = adding_S + c;
sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + int(S[j]-'0');
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:17:31: error: 'c' was not declared in this scope
17 | adding_S = adding_S + c;
| ^
|
s068076453
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
char c= S[i];
sum = sum + stoi(c);
adding_S = adding_S + c;
sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
char c2=S[j];
sum = sum + stoi(c2);
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:17:25: error: no matching function for call to 'stoi(char&)'
17 | sum = sum + stoi(c);
| ~~~~^~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from 'char' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from 'char' to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:22:29: error: no matching function for call to 'stoi(char&)'
22 | sum = sum + stoi(c2);
| ~~~~^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from 'char' to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from 'char' to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
|
s854146302
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + stoi(S[i]);
adding_S = adding_S + S[i];
sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + stoi(S[j]);
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:25: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
16 | sum = sum + stoi(S[i]);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:20:29: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
20 | sum = sum + stoi(S[j]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
|
s720177577
|
p04001
|
C++
|
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main(void){
string S;
string adding_S;
char* Sp=&S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + stoi(S[i]);
adding_S = adding_S + S[i];
sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + stoi(S[j]);
}
}
cout << sum << endl;
}
|
a.cc:9:3: error: extended character is not valid in an identifier
9 | char* Sp=&S;
| ^
a.cc: In function 'int main()':
a.cc:9:3: error: '\U00003000char' was not declared in this scope
9 | char* Sp=&S;
| ^~~~~~
a.cc:9:11: error: 'Sp' was not declared in this scope; did you mean 'S'?
9 | char* Sp=&S;
| ^~
| S
a.cc:17:25: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
17 | sum = sum + stoi(S[i]);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:21:29: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
21 | sum = sum + stoi(S[j]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
|
s852480020
|
p04001
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + stoi(S[i]);
adding_S = adding_S + S[i];
sum = sum + stoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + stoi(S[j]);
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:25: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
15 | sum = sum + stoi(S[i]);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
a.cc:19:29: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
19 | sum = sum + stoi(S[j]);
| ~~~~^~~~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
|
s367913183
|
p04001
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + atoi(S[i].c_str());
adding_S = adding_S + S[i];
sum = sum + atoi(adding_S.c_str());
for(j=i+1;j<size;j++){
sum = sum + atoi(S[j].c_str());
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:31: error: request for member 'c_str' in 'S.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
15 | sum = sum + atoi(S[i].c_str());
| ^~~~~
a.cc:19:35: error: request for member 'c_str' in 'S.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)j))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
19 | sum = sum + atoi(S[j].c_str());
| ^~~~~
|
s298378657
|
p04001
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length();
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + atoi(S[i]);
adding_S = adding_S + S[i];
sum = sum + atoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + atoi(S[j]);
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:25: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
15 | sum = sum + atoi(S[i]);
| ~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
a.cc:17:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
17 | sum = sum + atoi(adding_S);
| ^~~~~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
a.cc:19:29: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
19 | sum = sum + atoi(S[j]);
| ~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
|
s370337422
|
p04001
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main(void){
string S;
string adding_S;
cin >> S;
int size = S.length;
int i,j;
int sum;
for(i=0;i<size;i++){
sum = sum + atoi(S[i]);
adding_S = adding_S + S[i];
sum = sum + atoi(adding_S);
for(j=i+1;j<size;j++){
sum = sum + atoi(S[j]);
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:10:18: error: cannot convert 'std::__cxx11::basic_string<char>::length' from type 'std::__cxx11::basic_string<char>::size_type (std::__cxx11::basic_string<char>::)() const noexcept' {aka 'long unsigned int (std::__cxx11::basic_string<char>::)() const noexcept'} to type 'int'
10 | int size = S.length;
| ^~~~~~
a.cc:15:25: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
15 | sum = sum + atoi(S[i]);
| ~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
a.cc:17:26: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const char*'
17 | sum = sum + atoi(adding_S);
| ^~~~~~~~
| |
| std::string {aka std::__cxx11::basic_string<char>}
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
a.cc:19:29: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
19 | sum = sum + atoi(S[j]);
| ~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
|
s898991317
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;
void ARC060C()
{
int N, A;
cin >> N >> A;
vector<int> vals(N);
for (auto& x : vals)
{
cin >> x;
}
vector<vector<vector<long long> > > dp(N + 1, vector<vector<long long> >(N + 1, vector<long long>(2501)));
dp[1][1][vals.front()] = 1;
for (int i = 1; i < N; ++i)
{
dp[i][0][0] = 1;
for (int j = 1; j <= i + 1; ++j)
{
for (int k = 1; k <= 2500; ++k)
{
int res = k - vals[i];
dp[i + 1][j][k] = dp[i][j][k];
if(res >= 0 && res < 2501)
dp[i+1][j][k] += dp[i][j - 1][res];
}
}
}
long long sum = 0;
for (int i = 1; i <= N; ++i)
{
sum += dp[N][i][A*i];
}
cout << sum << endl;
}
int main()
{
ARC061C();
return 0;
}
|
a.cc: In function 'int main()':
a.cc:52:9: error: 'ARC061C' was not declared in this scope; did you mean 'ARC060C'?
52 | ARC061C();
| ^~~~~~~
| ARC060C
|
s297189419
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
if(S.size()==1){
int n = stoi(S);
cout<<n;
}
else{
vector<string> op;
op = {"","+"};
vector<string> score(pow(2,S.size()-1));
for(int i;i<S.size();i++){
for(int j=0;j<2;j++){
if(i<S.size()-1){
score.at()+=S.at(i)+op.at(j);
}
else{
score.at()+=S.at(i);
}
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:19:13: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::at()'
19 | score.at()+=S.at(i)+op.at(j);
| ~~~~~~~~^~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&; size_type = long unsigned int]'
1180 | at(size_type __n)
| ^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; const_reference = const std::__cxx11::basic_string<char>&; size_type = long unsigned int]'
1199 | at(size_type __n) const
| ^~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate expects 1 argument, 0 provided
a.cc:22:17: error: no matching function for call to 'std::vector<std::__cxx11::basic_string<char> >::at()'
22 | score.at()+=S.at(i);
| ~~~~~~~~^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate: 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::at(size_type) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; reference = std::__cxx11::basic_string<char>&; size_type = long unsigned int]'
1180 | at(size_type __n)
| ^~
/usr/include/c++/14/bits/stl_vector.h:1180:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate: 'std::vector<_Tp, _Alloc>::const_reference std::vector<_Tp, _Alloc>::at(size_type) const [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >; const_reference = const std::__cxx11::basic_string<char>&; size_type = long unsigned int]'
1199 | at(size_type __n) const
| ^~
/usr/include/c++/14/bits/stl_vector.h:1199:7: note: candidate expects 1 argument, 0 provided
|
s082107356
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
if(S.size()==1){
int n = stoi(S);
cout<<n;
}
else{
vector<string> op;
op = {"","+"};
vector<string> score();
for(int i;i<S.size();i++){
for(int j=0;j<2;j++){
if(i<S.size-1){
score+=S.at(i)+op.at(j);
}
else{
score+=S.at(i);
}
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:14:23: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
14 | vector<string> score();
| ^~
a.cc:14:23: note: remove parentheses to default-initialize a variable
14 | vector<string> score();
| ^~
| --
a.cc:18:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
18 | if(i<S.size-1){
| ~~^~~~
| ()
a.cc:19:10: error: no match for 'operator+=' (operand types are 'std::vector<std::__cxx11::basic_string<char> >()' and 'std::__cxx11::basic_string<char>')
19 | score+=S.at(i)+op.at(j);
| ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:22:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
22 | score+=S.at(i);
| ~~~~~^~~~~~~~~
a.cc:22:14: error: assignment of read-only location 'score'
|
s318052893
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin>>S;
if(S.size()==1){
int n = stoi(S);
cout<<n;
}
else{
vector<string> op;
op = {,+};
vector<string> score();
for(int i;i<S.size();i++){
for(int j=0;j<2;j++){
if(i<S.size-1){
score+=S.at(i)+op.at(j);
}
else{
score+=S.at(i);
}
}
}
}
}
|
a.cc: In function 'int main()':
a.cc:13:9: error: expected primary-expression before ',' token
13 | op = {,+};
| ^
a.cc:13:11: error: expected primary-expression before '}' token
13 | op = {,+};
| ^
a.cc:13:11: error: no match for 'operator=' (operand types are 'std::vector<std::__cxx11::basic_string<char> >' and '<brace-enclosed initializer list>')
In file included from /usr/include/c++/14/vector:72,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<std::__cxx11::basic_string<char> >&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::__cxx11::basic_string<char> >&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = std::__cxx11::basic_string<char>; _Alloc = std::allocator<std::__cxx11::basic_string<char> >]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<std::__cxx11::basic_string<char> >'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:14:23: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
14 | vector<string> score();
| ^~
a.cc:14:23: note: remove parentheses to default-initialize a variable
14 | vector<string> score();
| ^~
| --
a.cc:18:14: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
18 | if(i<S.size-1){
| ~~^~~~
| ()
a.cc:19:10: error: no match for 'operator+=' (operand types are 'std::vector<std::__cxx11::basic_string<char> >()' and 'std::__cxx11::basic_string<char>')
19 | score+=S.at(i)+op.at(j);
| ~~~~~^~~~~~~~~~~~~~~~~~
a.cc:22:14: warning: pointer to a function used in arithmetic [-Wpointer-arith]
22 | score+=S.at(i);
| ~~~~~^~~~~~~~~
a.cc:22:14: error: assignment of read-only location 'score'
|
s083369740
|
p04001
|
C++
|
s = input()
l = len(s)
ans = 0
for mask in range(2 ** (l-1)):
f = s
last_plus = 0
for bit in range(l-1):
if (mask >> bit) & 1:
ans += int(s[last_plus: bit+1])
last_plus = bit + 1
ans += int(s[last_plus:])
print(ans)
|
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s545099405
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int kotae(int a){
if(a/10==0){
return a;
}
int t=0;
for(int i<=10;i<a;i=i*10){
t=t+kotae(a/i)+a%i*std::pow(2,log10(a/i));
}
return a+t;
}
int main() {
int suuzi;
cin >>suuzi;
cout<<kotae(suuzi)<<endl;
}
|
a.cc: In function 'int kotae(int)':
a.cc:9:13: error: expected ';' before '<=' token
9 | for(int i<=10;i<a;i=i*10){
| ^~
| ;
a.cc:9:13: error: expected primary-expression before '<=' token
9 | for(int i<=10;i<a;i=i*10){
| ^~
a.cc:9:21: error: expected ')' before ';' token
9 | for(int i<=10;i<a;i=i*10){
| ~ ^
| )
a.cc:9:22: error: 'i' was not declared in this scope
9 | for(int i<=10;i<a;i=i*10){
| ^
|
s095278771
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int dfs(int sum, int r, string s, int dp){
if(dp=s.size()){
return sum + r;
}
else{
int a = dfs(sum + r, s(dp)-'0', s, dp+1);//'+'in
int b = dfs(sum, r*10+s(dp)-'0',s,dp+1);//not'+'in
return a+b;
}
}
int main(){
string s;
cin >> s;
cout << dfs(0,s[0]-'0',s,0) << endl;
}
|
a.cc: In function 'int dfs(int, int, std::string, int)':
a.cc:9:27: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
9 | int a = dfs(sum + r, s(dp)-'0', s, dp+1);//'+'in
| ~^~~~
a.cc:10:28: error: no match for call to '(std::string {aka std::__cxx11::basic_string<char>}) (int&)'
10 | int b = dfs(sum, r*10+s(dp)-'0',s,dp+1);//not'+'in
| ~^~~~
|
s700225345
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <array>
#include <unordered_map>
#include <unordered_set>
using namespace std;
int main (int argc, char* argv[]) {
string s;
cin >> s;
vector<long long> dp(s.size());
for (int i = 0; i < s.size(); i++) {
long long total = 0;
long long current = 0;
long long power = 1;
for (int j = i; j >= 0; j--) {
current = current + (s[j] - '0') * power;
power *= 10;
long long prev_res = (j == 0 ? 0 : dp[j - 1]);
total += prev_res + (current * pow(2, j == 0 ? 0 : j - 1));
}
dp[i] = total;
}
cout << dp.back() << endl;
}
|
a.cc: In function 'int main(int, char**)':
a.cc:23:56: error: 'pow' was not declared in this scope; did you mean 'power'?
23 | total += prev_res + (current * pow(2, j == 0 ? 0 : j - 1));
| ^~~
| power
|
s075189960
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
string S;
cin >> S;
//文字列1+23+4を計算する
S.push_back('+');
string l;
int sum = 0;
for(int i=0;i<S.size();i++){
if(S[i] != '+'){
l.push_back(S[i]);
}
else {
sum += stoi(l);
l = " ";
}
}
for(int bit = 0;bit< (1<<S.size()-1);bit++){
for (int i = 0; i < S.size()-1; ++i) {
if (bit & (1<<i)) { // i が bit に入るかどうか
S.insert(i+1,'+');
}
|
a.cc:22:1: error: extended character is not valid in an identifier
22 | if (bit & (1<<i)) { // i が bit に入るかどうか
| ^
a.cc:22:1: error: extended character is not valid in an identifier
a.cc:22:1: error: extended character is not valid in an identifier
a.cc:23:1: error: extended character is not valid in an identifier
23 | S.insert(i+1,'+');
| ^
a.cc:23:1: error: extended character is not valid in an identifier
a.cc:23:1: error: extended character is not valid in an identifier
a.cc:23:1: error: extended character is not valid in an identifier
a.cc:23:1: error: extended character is not valid in an identifier
a.cc: In function 'int main()':
a.cc:22:1: error: '\U00003000\U00003000\U00003000if' was not declared in this scope
22 | if (bit & (1<<i)) { // i が bit に入るかどうか
| ^~~~~~~~
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:21:40: note: to match this '{'
21 | for (int i = 0; i < S.size()-1; ++i) {
| ^
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:20:44: note: to match this '{'
20 | for(int bit = 0;bit< (1<<S.size()-1);bit++){
| ^
a.cc:24:2: error: expected '}' at end of input
24 | }
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s667545231
|
p04001
|
C++
|
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
int main(void){
string S;
cin >> S;
int len = S.length();
ll ans = 0;
for(int i=0; i<(1 << (len - 1)); i++){
ll res = 0, last = 0;
for(int j=0; j<len; j++){
last = 10 * last + (s[j] - '0');
if(i & (1 << j)){
res += last;
last = 0;
}
}
ans += res + last;
}
cout << ans;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:20:45: error: 's' was not declared in this scope
20 | last = 10 * last + (s[j] - '0');
| ^
|
s426441564
|
p04001
|
C++
|
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int INF = 1<<30;
string s;int n;
ll calc(int a, int b){
ll tmp=0;
while(a!=b){
tmp = tmp*(ll)10+ll(s[a]-'0');
a++;
}
return tmp;
}
int main(){
cin>>s;
n=(int)s.size();
ll ans=0;
for(int i=0;i<(1<<n-1);i++){
ll res=0;
int last_j=0;
for(int j=0;j<n-1;j++){
int start=0;
if((i>>j)&1)!=0){
res+=calc(start, j+1);
start=j+1;
last_j=j;
}
}
res+=calc(last_j, n);
ans+=res;
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:24:19: error: expected primary-expression before '!=' token
24 | if((i>>j)&1)!=0){
| ^~
|
s563691911
|
p04001
|
C++
|
#include<bits/stdc++.h>
using namespace std;
int main(){
long i,j,k,N,ans=0,pow[12],x;
char ss[20];
scanf("%s",ss);
N=strlen(ss);
pow[0]=1;
for(i=1;i<10;i++)pow[i]=pow[i-1]*2;
pow[10]=1;pow[11]=1;
for(i=1,i<=N;i++){
for(j=0,j<=N-i;j++){
x=0;
for(k=0;k<i;k++){
x*=10;
x+=ss[j+k];
}
if(j==0||j==N-i){
ans+=x*pow[(N-i+10)%11];
}else{
ans+=x*pow[(N-i+10)%12];
}
}
}
cout <<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:12:17: error: expected ';' before ')' token
12 | for(i=1,i<=N;i++){
| ^
| ;
a.cc:13:19: error: expected ';' before ')' token
13 | for(j=0,j<=N-i;j++){
| ^
| ;
|
s682105969
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
//positionbit目が立っているか判定
bool contain(int mask, int position){
if((mask & (1 << position)) != 0) return true;
else return false;
}
int main(void){
string s; cin >> s;
int n = s.size() - 1;
ll sum = 0;
for(int mask = 0; mask < (1 << n); ++mask){
int l = 0;//左端
ll tmp = 0;
int r;//右端
for (r = 0; r < n; ++r){
if(contain(mask, r)){
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
l = r + 1;
}
}
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
sum += tmp;
}
printf("%lld\n", sum);
return 0;
}
mmxsrup (id:mmxsrup) 2年前
|
a.cc:39:12: error: found ':' in nested-name-specifier, expected '::'
39 | mmxsrup (id:mmxsrup) 2年前
| ^
| ::
a.cc:39:9: error: expected constructor, destructor, or type conversion before '(' token
39 | mmxsrup (id:mmxsrup) 2年前
| ^
|
s664146739
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
//positionbit目が立っているか判定
bool contain(int mask, int position){
if((mask & (1 << position)) != 0) return true;
else return false;
}
int main(void){
string s; cin >> s;
int n = s.size() - 1;
ll sum = 0;
for(int mask = 0; mask < (1 << n); ++mask){
int l = 0;//左端
ll tmp = 0;
int r;//右端
for (r = 0; r < n; ++r){
if(contain(mask, r)){
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
l = r + 1;
}
}
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
sum += tmp;
}
printf("%lld\n", sum);
return 0;
}
mmxsrup (id:mmxsrup) 2年前
|
a.cc:39:12: error: found ':' in nested-name-specifier, expected '::'
39 | mmxsrup (id:mmxsrup) 2年前
| ^
| ::
a.cc:39:9: error: expected constructor, destructor, or type conversion before '(' token
39 | mmxsrup (id:mmxsrup) 2年前
| ^
|
s768224447
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(n);i++)
//positionbit目が立っているか判定
bool contain(int mask, int position){
if((mask & (1 << position)) != 0) return true;
else return false;
}
int main(void){
string s; cin >> s;
int n = s.size() - 1;
ll sum = 0;
for(int mask = 0; mask < (1 << n); ++mask){
int l = 0;//左端
ll tmp = 0;
int r;//右端
for (r = 0; r < n; ++r){
if(contain(mask, r)){
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
l = r + 1;
}
}
string t = s.substr(l, r - l + 1);
ll num = stoll(t);
tmp += num;
sum += tmp;
}
printf("%lld\n", sum);
return 0;
}
mmxsrup (id:mmxsrup) 2年前
|
a.cc:39:12: error: found ':' in nested-name-specifier, expected '::'
39 | mmxsrup (id:mmxsrup) 2年前
| ^
| ::
a.cc:39:9: error: expected constructor, destructor, or type conversion before '(' token
39 | mmxsrup (id:mmxsrup) 2年前
| ^
|
s193427534
|
p04001
|
C++
|
# -*- coding: utf-8 -*-
s = input()
n = len(s)
ans = 0
if n == 1:
print(int(s))
exit()
for i in range(2 ** (n - 1)):
tmp = int(s[0])
for j in range(n - 1):
if (i >> j) & 1:
ans += tmp
tmp = 0
tmp = tmp * 10 + int(s[j + 1])
ans += tmp
print(ans)
|
a.cc:1:3: error: invalid preprocessing directive #-
1 | # -*- coding: utf-8 -*-
| ^
a.cc:3:1: error: 's' does not name a type
3 | s = input()
| ^
|
s131497014
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
int a = N;
int keta = 0;
while (a > 0) {
keta++;
a /= 10;
}
int sum = N;
for(int i = 1; i < keta; i++) {
sum += pow(2, (keta - i - 1)) * (a % pow(10, i));
sum += pow(2, (i - 1)) * (a / pow(10, i));
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:40: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
16 | sum += pow(2, (keta - i - 1)) * (a % pow(10, i));
| ~ ^ ~~~~~~~~~~
| | |
| int __gnu_cxx::__promote<double>::__type {aka double}
|
s573499557
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long signed int ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
string S;
vector<int> number;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin>>S;
REP(i, S.length()) {
number.push_back(atoi(S[S.length() - i - 1]));
}
int sum = 0;
for (int bit = 0; bit < (1 << S.length()-1); ++bit) {
int tmp = 1;
REP(i, S.length() - 1) {
if (!(bit | (1 << i))) {
tmp *= 10;
}
sum+=number[i] * tmp;
}
}
cout << sum << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:23:38: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
23 | number.push_back(atoi(S[S.length() - i - 1]));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
|
s372865478
|
p04001
|
C++
|
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long signed int ll;
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(obj) (obj).begin(),(obj).end()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
string S;
vector<int> number;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
cin>>S;
REP(i, S.length()) {
number.push_back(atoi(S[S.length - i - 1]));
}
int sum = 0;
for (int bit = 0; bit < (1 << S.length()-1); ++bit) {
int tmp = 1;
REP(i, S.length() - 1) {
if (!(bit | (1 << i))) {
tmp *= 10;
}
sum+=number[i] * tmp;
}
}
cout << sum << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:23:43: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::length() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
23 | number.push_back(atoi(S[S.length - i - 1]));
| ~~^~~~~~
| ()
|
s699862394
|
p04001
|
C++
|
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
using namespace std;
using ll = long long;
using R = double;
using Data = pair < ll, vector <ll>>;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll MOD = 1e9 + 7;
const ll inf = 1LL << 60;
struct edge { ll from; ll to; ll cost; };
typedef pair<ll, ll>pll;
#define all(x) (x).begin(),(x).end()
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)
#define INF INT_MAX/2
int N, M;
vector<pair<int, int>>e[101010];
ll dist[101010];
int used[101010];
void dijkstra() {
rep(i, 0, 101010)dist[i] = inf;
dist[0] = 0;
min_priority_queue<tuple<ll,ll,ll>>q;
q.push((0,0,-1));
while (q.size()) {
auto p = q.top();
q.pop();
ll d = get<0>(p);
int cur = get<1>(p);
int last = get<2>(p);
if (used[cur])continue;
used[cur] = 1;
fore(x,e[cur]) {
ll cc = d + ((x.second == last) ? 0 : 1);
if (cc < dist[x.first]) {
dist[x.first] = cc;
q.push(( cc,x.first,x.second ));
}
}
}
}
int main() {
cin >> N >> M;
rep(i, 0, M) {
int p, q, r;
cin >> p >> q >> r;
p--, q--;
e[p].pb({ q,r });
e[q].pb({ p,r });
}
dijkstra();
if (dist[N - 1] == inf) {
cout << -1 << endl;
}
else {
cout << dist[N - 1] << endl;
}
return 0;
}
|
a.cc: In function 'void dijkstra()':
a.cc:48:15: error: no matching function for call to 'std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::push(int)'
48 | q.push((0,0,-1));
| ~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/14/queue:66,
from a.cc:18:
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<long long int, long long int, long long int>; _Sequence = std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >; _Compare = std::greater<std::tuple<long long int, long long int, long long int> >; value_type = std::tuple<long long int, long long int, long long int>]'
736 | push(const value_type& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note: no known conversion for argument 1 from 'int' to 'const std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::value_type&' {aka 'const std::tuple<long long int, long long int, long long int>&'}
736 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::tuple<long long int, long long int, long long int>; _Sequence = std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >; _Compare = std::greater<std::tuple<long long int, long long int, long long int> >; value_type = std::tuple<long long int, long long int, long long int>]'
744 | push(value_type&& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note: no known conversion for argument 1 from 'int' to 'std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::value_type&&' {aka 'std::tuple<long long int, long long int, long long int>&&'}
744 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~
a.cc:61:39: error: no matching function for call to 'std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::push(int&)'
61 | q.push(( cc,x.first,x.second ));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_queue.h:736:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::tuple<long long int, long long int, long long int>; _Sequence = std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >; _Compare = std::greater<std::tuple<long long int, long long int, long long int> >; value_type = std::tuple<long long int, long long int, long long int>]'
736 | push(const value_type& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:736:30: note: no known conversion for argument 1 from 'int' to 'const std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::value_type&' {aka 'const std::tuple<long long int, long long int, long long int>&'}
736 | push(const value_type& __x)
| ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_queue.h:744:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = std::tuple<long long int, long long int, long long int>; _Sequence = std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >; _Compare = std::greater<std::tuple<long long int, long long int, long long int> >; value_type = std::tuple<long long int, long long int, long long int>]'
744 | push(value_type&& __x)
| ^~~~
/usr/include/c++/14/bits/stl_queue.h:744:25: note: no known conversion for argument 1 from 'int' to 'std::priority_queue<std::tuple<long long int, long long int, long long int>, std::vector<std::tuple<long long int, long long int, long long int>, std::allocator<std::tuple<long long int, long long int, long long int> > >, std::greater<std::tuple<long long int, long long int, long long int> > >::value_type&&' {aka 'std::tuple<long long int, long long int, long long int>&&'}
744 | push(value_type&& __x)
| ~~~~~~~~~~~~~^~~
|
s708156139
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(){
string S;
cin >> S;
long long ans = 0;
for(int i = 0; s < (1 << (S.size() - 1)); i++){
string now;
now = S.at(0);
for(int j = 0; j < S.size() - 1; j++){
if(i & (1 << j)) now += "+";
now += S.at(j + 1);
}
long long sum = 0;
int pos = 0;
while(now.find("+", pos) != string::npos){
int nextpos = now.find("+" , pos);
sum += stoll(now.substr(pos, nextpos - pos));
pos = nextpos + 1;
}
sum += stoll(now.substr(pos));
ans += sum;
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:8:16: error: 's' was not declared in this scope
8 | for(int i = 0; s < (1 << (S.size() - 1)); i++){
| ^
|
s839937934
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;
#define rep(i,n) for(i=0;i<n;i++)
int main() {
ll a, b, c, d, e, f, g, h, i, j, n, m, l, sum = 0,aa[10];
string s;
cin >> s;
l = s.size - 1;
//rep(i, size(s))(cout << s[i]);
rep(i, (1 << l)) {
c = 0;
d = int(s[0])-'0';
rep(j,l){
if (i & (1 << j)) {
// cout << d << " ";
c =c+ d;
d = int(s[j + 1]) - '0';
}
else d = 10 * d + int(s[j + 1]) - '0';
}
// cout << d << " "<< c+d<< "\n";
sum = sum+ c + d;
}
cout << sum;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:14:15: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
14 | l = s.size - 1;
| ~~^~~~
| ()
|
s016961794
|
p04001
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))
#define REP0(i,n) for(i=0;i<n;i++)
#define REP1(i,n) for(i=1;i<n;i++)
int main(void)
{
char s[11];
int d[11];
scanf("%s",s);
int l;
l = strlen(s);//\0を抜いた文字列の長さ
int i,j;
REP(i,l) d[i]=s[i]-'0';
int ans=0,v;
//+を入れるか入れないかをbit探索
REP0(i,1<<l-1)//文字より一字少ない
{
v=d[0];
REP0(j,l-1)
{
if((i>>j)&1)
{
v=v*10+d[j+1];
}
else
{
ans+=v;
v=d[j+1];
}
}
ans+=v;
}
printf("%d",ans);
return 0;
}
|
main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'REP'; did you mean 'REP0'? [-Wimplicit-function-declaration]
20 | REP(i,l) d[i]=s[i]-'0';
| ^~~
| REP0
main.c:20:11: error: expected ';' before 'd'
20 | REP(i,l) d[i]=s[i]-'0';
| ^~
| ;
|
s512962566
|
p04001
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))
#define REP0(i,n) for(i=0;i<n;i++)
#define REP1(i,n) for(i=1;i<n;i++)
int main(void)
{
char s[11];
int d[11];
scanf("%s",s);
int l;
l = strlen(s);//\0を抜いた文字列の長さ
int i,j;
REP(i,l) d[i]=s[i]-'0';
int ans=0,v;
//+を入れるか入れないかをbit探索
REP0(i,1<<l-1)//文字より一字少ない
{
v=d[0];
REP0(j,l-1)
{
if((i>>j)&1)
{
v=v*10+d[j+1];
}
else
{
ans+=v;
v=d[j+1];
}
}
ans+=v
}
printf("%d",ans);
return 0;
}
|
main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'REP'; did you mean 'REP0'? [-Wimplicit-function-declaration]
20 | REP(i,l) d[i]=s[i]-'0';
| ^~~
| REP0
main.c:20:11: error: expected ';' before 'd'
20 | REP(i,l) d[i]=s[i]-'0';
| ^~
| ;
main.c:39:13: error: expected ';' before '}' token
39 | ans+=v
| ^
| ;
40 | }
| ~
|
s821417340
|
p04001
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))
#define REP0(i,n) for(i=0;i<n;i++)
#define REP1(i,n) for(i=1;i<n;i++)
int main(void)
{
char s[11];
int d[11];
scanf("%s",s);
int l;
l = strlen(s);//\0を抜いた文字列の長さ
int i,j;
REP(i,l) d[i]=s[i]-'0';
int ans=0,v;
//+を入れるか入れないかをbit探索
REP0(i,1<<l-1)//文字より一字少ない
{
v=d[0];
REP(j,l-1)
{
if((i>>j)&1)
{
v=v*10+d[j+1];
}
else
{
ans+=v;
v=d[j+1];
}
}
ans+=v
}
printf("%d",ans);
return 0;
}
|
main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'REP'; did you mean 'REP0'? [-Wimplicit-function-declaration]
20 | REP(i,l) d[i]=s[i]-'0';
| ^~~
| REP0
main.c:20:11: error: expected ';' before 'd'
20 | REP(i,l) d[i]=s[i]-'0';
| ^~
| ;
main.c:26:15: error: expected ';' before '{' token
26 | REP(j,l-1)
| ^
| ;
27 | {
| ~
|
s715464138
|
p04001
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))
#define REP0(i,n) for(i=0;i<n;i++)
#define REP1(i,n) for(i=1;i<n;i++)
int main(void)
{
char s[11];
int d[11];
scanf("%s",s);
int l;
l = strlen(s);//\0を抜いた文字列の長さ
int i,j;
REP(i,l) d[i]=s[i]-'0';
int ans=0,v;
//+を入れるか入れないかをbit探索
REP0(i,1<<l-1)//文字より一字少ない
{
v=d[0];
REP(j,l-1)
{
if((i>>j)&1)
{
v=v*10+d[j+1];
}
else
{
ans+=v;
v=d[j+1];
}
}
}
ans+=v
}
printf("%d",ans);
return 0;
}
|
main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'REP'; did you mean 'REP0'? [-Wimplicit-function-declaration]
20 | REP(i,l) d[i]=s[i]-'0';
| ^~~
| REP0
main.c:20:11: error: expected ';' before 'd'
20 | REP(i,l) d[i]=s[i]-'0';
| ^~
| ;
main.c:26:15: error: expected ';' before '{' token
26 | REP(j,l-1)
| ^
| ;
27 | {
| ~
main.c:40:11: error: expected ';' before '}' token
40 | ans+=v
| ^
| ;
41 | }
| ~
main.c: At top level:
main.c:42:10: error: expected declaration specifiers or '...' before string constant
42 | printf("%d",ans);
| ^~~~
main.c:42:15: error: unknown type name 'ans'
42 | printf("%d",ans);
| ^~~
main.c:43:3: error: expected identifier or '(' before 'return'
43 | return 0;
| ^~~~~~
main.c:44:1: error: expected identifier or '(' before '}' token
44 | }
| ^
|
s227768532
|
p04001
|
C
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define MAX(p,q) ((p>q)?(p):(q))
#define MIN(p,q) ((p<q)?(p):(q))
#define REP0(i,n) for(i=0;i<n;i++)
#define REP1(i,n) for(i=1;i<n;i++)
int main(void)
{
char s[11];
int d[11];
scanf("%s",s);
int l;
l = strlen(s);//\0を抜いた文字列の長さ
int i,j;
REP(i,l) d[i]=s[i]-'0';
int ans=0,v;
//+を入れるか入れないかをbit探索
REP0(i,1<<l-1)//文字より一字少ない
{
v=d[0];
REP(j,l-1)
{
if()(i>>j)&1)
{
v=v*10+d[j+1];
}
else
{
ans+=v;
v=d[j+1];
}
}
}
ans+=v
}
printf("%d",ans);
return 0;
}
|
main.c: In function 'main':
main.c:20:3: error: implicit declaration of function 'REP'; did you mean 'REP0'? [-Wimplicit-function-declaration]
20 | REP(i,l) d[i]=s[i]-'0';
| ^~~
| REP0
main.c:20:11: error: expected ';' before 'd'
20 | REP(i,l) d[i]=s[i]-'0';
| ^~
| ;
main.c:26:15: error: expected ';' before '{' token
26 | REP(j,l-1)
| ^
| ;
27 | {
| ~
main.c: At top level:
main.c:40:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '+=' token
40 | ans+=v
| ^~
main.c:42:10: error: expected declaration specifiers or '...' before string constant
42 | printf("%d",ans);
| ^~~~
main.c:42:15: error: unknown type name 'ans'
42 | printf("%d",ans);
| ^~~
main.c:43:3: error: expected identifier or '(' before 'return'
43 | return 0;
| ^~~~~~
main.c:44:1: error: expected identifier or '(' before '}' token
44 | }
| ^
|
s601498490
|
p04001
|
C++
|
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#define ll long long
using namespace std;
ll stoll(string str)
{
int len=str.size();
ll sum=0;
for(int i=0;i<len;i++)
{
sum=sum*10+(str[i]-'0');
}
return sum;
}
ll int search(string s1,ll presum){
int i;
ll k,sum;
sum = 0;
for (i=1;i<=s1.size();i++){
string s2 = s1.substr(0,i);//[0,i)
string s3 = s1.substr(i);
if (s3==""){
s3 = "AC";//---//---//
}
if(i == s1.size()){
sum += stoll(s1)+presum;//---
}else{
k = stoll(s2);//---
if (s3=="AC"){
sum += k + presum;//--
}else{
sum += search(s3,k + presum);
}
}
}
return sum;//
}
int main(){
ll sum;
string s;
cin >> s;
sum = search(s,0);//dfs
cout << sum;
return 0;
}
|
a.cc: In function 'long long int search(std::string, long long int)':
a.cc:27:29: error: call of overloaded 'stoll(std::string&)' is ambiguous
27 | sum += stoll(s1)+presum;//---
| ~~~~~^~~~
a.cc:6:4: note: candidate: 'long long int stoll(std::string)'
6 | ll stoll(string str)
| ^~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
4180 | stoll(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~~
a.cc:29:22: error: call of overloaded 'stoll(std::string&)' is ambiguous
29 | k = stoll(s2);//---
| ~~~~~^~~~
a.cc:6:4: note: candidate: 'long long int stoll(std::string)'
6 | ll stoll(string str)
| ^~~~~
/usr/include/c++/14/bits/basic_string.h:4180:3: note: candidate: 'long long int std::__cxx11::stoll(const std::string&, std::size_t*, int)'
4180 | stoll(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~~
|
s126627183
|
p04001
|
C++
|
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
string s;
cin >> s;
int n = s.size() - 1;
lint ans = 0;
rep(i, 1 << n)
{
lint num = 0;
lint cc = s[0] - '0';
rep(j, n)
{
if ((i >> j) & 1)
{
num += cc;
cc = s[j + 1] - '0';
}
else
{
cc *= 10;
cc += s[j+1] - '0';
}
}
num += cc;
ans += num;
}
cout << ans << endl;
return 0;
}#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
const int INF = 1e7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repi(i, k, n) for (int i = (k); i < (int)(n); ++i)
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(), (x).end()
#define pb push_back
int main()
{
string s;
cin >> s;
int n = s.size() - 1;
lint ans = 0;
rep(i, 1 << n)
{
lint num = 0;
lint cc = s[0] - '0';
rep(j, n)
{
if ((i >> j) & 1)
{
num += cc;
cc = s[j + 1] - '0';
}
else
{
cc *= 10;
cc += s[j+1] - '0';
}
}
num += cc;
ans += num;
}
cout << ans << endl;
return 0;
}
|
a.cc:41:2: error: stray '#' in program
41 | }#include "bits/stdc++.h"
| ^
a.cc:41:3: error: 'include' does not name a type
41 | }#include "bits/stdc++.h"
| ^~~~~~~
a.cc:43:11: error: redefinition of 'const int MOD'
43 | const int MOD = 1e9 + 7;
| ^~~
a.cc:3:11: note: 'const int MOD' previously defined here
3 | const int MOD = 1e9 + 7;
| ^~~
a.cc:45:11: error: redefinition of 'const int INF'
45 | const int INF = 1e7;
| ^~~
a.cc:5:11: note: 'const int INF' previously defined here
5 | const int INF = 1e7;
| ^~~
a.cc:53:5: error: redefinition of 'int main()'
53 | int main()
| ^~~~
a.cc:13:5: note: 'int main()' previously defined here
13 | int main()
| ^~~~
|
s883566635
|
p04001
|
C++
|
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int search(string s1){
int i,sum,k;
sum = 0;
std::string s3,s2;
for (i=1;i<=s1.size();i++){
s2 = s1.substr(0,i);
s3 = s1.substr(i);
if(s2 == ""){
s2 = "0";
k = stoi(s2);
sum += k + search(s3);
}
return sum;
}
int main(void){
int sum;
std::string s;
cin >> s;
sum = search(s);
printf("%d", sum);
return 0;
}
|
a.cc: In function 'int search(std::string)':
a.cc:20:15: error: a function-definition is not allowed here before '{' token
20 | int main(void){
| ^
a.cc:27:2: error: expected '}' at end of input
27 | }
| ^
a.cc:6:22: note: to match this '{'
6 | int search(string s1){
| ^
a.cc:27:2: warning: control reaches end of non-void function [-Wreturn-type]
27 | }
| ^
|
s256417164
|
p04001
|
C++
|
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main(void){
int sum;
string s;
scanf("%s",&s);
sum = search(s);
printf("%d", sum);
return 0;
}
int search(string s){
int i,sum;
sum = 0;
string s2,s3;
for (i=0;i<s.size();i++){
s2 = str.substr(0,i);
s3 = str.substr(i);
sum += (int)(s2) + search(s3);
}
return sum;
}
|
a.cc: In function 'int main()':
a.cc:8:21: error: no matching function for call to 'search(std::string&)'
8 | sum = search(s);
| ~~~~~~^~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
2332 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate expects 5 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
4090 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
4184 | search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate expects 6 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate expects 5 arguments, 1 provided
a.cc: In function 'int search(std::string)':
a.cc:17:14: error: 'str' was not declared in this scope; did you mean 'std'?
17 | s2 = str.substr(0,i);
| ^~~
| std
a.cc:19:16: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int'
19 | sum += (int)(s2) + search(s3);
| ^~~~~~~~~
|
s209913040
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(void){
int sum,i,j,prej;
string s;
scanf("%s",&s);
sum = 0;
printf("%d", search(s));
return 0;
}
int search(string s){
int i,sum;
sum = 0;
string s2,s3;
for (i=0;i<s.size();i++){
s2 = str.substr(0,i);
s3 = str.substr(i);
sum += (int)(s2) + search(s3);
}
return sum;
}
|
a.cc: In function 'int main()':
a.cc:8:28: error: no matching function for call to 'search(std::string&)'
8 | printf("%d", search(s));
| ~~~~~~^~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate: 'template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> _ForwardIterator1 std::search(_ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
2332 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algobase.h:2332:5: note: candidate expects 5 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate: 'template<class _FIter1, class _FIter2> _FIter1 std::search(_FIter1, _FIter1, _FIter2, _FIter2)'
4090 | search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4090:5: note: candidate expects 4 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate: 'template<class _ForwardIterator, class _Searcher> _ForwardIterator std::search(_ForwardIterator, _ForwardIterator, const _Searcher&)'
4184 | search(_ForwardIterator __first, _ForwardIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_algo.h:4184:5: note: candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2, _BinaryPredicate)'
112 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:112:1: note: candidate expects 6 arguments, 1 provided
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate: 'template<class _ExecutionPolicy, class _ForwardIterator1, class _ForwardIterator2> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::search(_ExecutionPolicy&&, _ForwardIterator1, _ForwardIterator1, _ForwardIterator2, _ForwardIterator2)'
117 | search(_ExecutionPolicy&& __exec, _ForwardIterator1 __first, _ForwardIterator1 __last, _ForwardIterator2 __s_first,
| ^~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:117:1: note: candidate expects 5 arguments, 1 provided
a.cc: In function 'int search(std::string)':
a.cc:16:14: error: 'str' was not declared in this scope; did you mean 'std'?
16 | s2 = str.substr(0,i);
| ^~~
| std
a.cc:18:16: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'int'
18 | sum += (int)(s2) + search(s3);
| ^~~~~~~~~
|
s490997047
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
typedef long long ll;
using namespace std;
//int a[10]={};
int le;
int tot=0;
string s;
int dfs(int i, string s){
if (i == le){
int tsum=0,tsu=0;
for (int j=0;j<s.length();j++){
if (s[j] != '+'){
tsum += tsu;
tsu = 0;
}else{
tsu += 10*tsu + s[j];
}
}
return tsum;
}
tot += dfs(i+1,s); //not insert + at i
int pos = s.length()-(le-i)+1;
s.insert(pos,'+');
tot += dfs(i+1,s); //insert + at i
return tot;
}
int main(){
cin >> s;
le=s.length();
//for (int i=0;i<le;i++) a[i] = s[i];
cout << dfs(0,s) << endl;
}
|
a.cc: In function 'int dfs(int, std::string)':
a.cc:31:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(int&, char)'
31 | s.insert(pos,'+');
| ~~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match)
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: conversion of argument 2 would be ill-formed:
a.cc:31:16: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
31 | s.insert(pos,'+');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1876 | insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::insert(size_type, const _Tp&) [with _Tp = char]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
a.cc:31:11: required from here
31 | s.insert(pos,'+');
| ~~~~~~~~^~~~~~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2086 | insert(size_type __pos1, const _Tp& __svt,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]'
1831 | insert(const_iterator __p, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1911:29: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::const_iterator'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1939 | insert(size_type __pos1, const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1939:52: note: no known conversion for argument 2 from 'char' to 'const std::__cxx11::basic_string<char>&'
1939 | insert(size_type __pos1, const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1963 | insert(size_type __pos1, const basic_string& __str,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1987 | insert(size_type __pos, const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2032 | insert(size_type __pos, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
2051 | insert(__const_iterator __p, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2051:31: note: no known conversion for argument 1 from 'int' to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2051 | insert(__const_iterator __p, _CharT __c)
| ~~~~~~~~~~~~~~~~~^~~
|
s817677248
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
typedef long long ll;
using namespace std;
//int a[10]={};
int le;
int tot=0;
string s;
int dfs(int i, string s){
if (i == le){
int tsum=0,tsu=0;
for (int j=0;j<s.length();j++){
if (s[j] != '+'){
tsum += tsu;
tsu = 0;
}else{
tsu += 10*tsu + s[j];
}
}
return tsum;
}
tot += dfs(i+1,s); //not insert + at i
s.insert(s.length()-(le-i)+1,'+');
tot += dfs(i+1,s); //insert + at i
return tot;
}
int main(){
cin >> s;
le=s.length();
//for (int i=0;i<le;i++) a[i] = s[i];
cout << dfs(0,s) << endl;
}
|
a.cc: In function 'int dfs(int, std::string)':
a.cc:30:11: error: no matching function for call to 'std::__cxx11::basic_string<char>::insert(std::__cxx11::basic_string<char>::size_type, char)'
30 | s.insert(s.length()-(le-i)+1,'+');
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:2007:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (near match)
2007 | insert(size_type __pos, const _CharT* __s)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2007:7: note: conversion of argument 2 would be ill-formed:
a.cc:30:32: error: invalid conversion from 'char' to 'const char*' [-fpermissive]
30 | s.insert(s.length()-(le-i)+1,'+');
| ^~~
| |
| char
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate: 'template<class _InputIterator, class> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
1876 | insert(const_iterator __p, _InputIterator __beg, _InputIterator __end)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1876:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2069:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = char; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2069:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::insert(size_type, const _Tp&) [with _Tp = char]'
2069 | insert(size_type __pos, const _Tp& __svt)
| ^~~~~~
a.cc:30:11: required from here
30 | s.insert(s.length()-(le-i)+1,'+');
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>'
2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^~~~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _Tp&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
2086 | insert(size_type __pos1, const _Tp& __svt,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2086:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator; size_type = long unsigned int]'
1831 | insert(const_iterator __p, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1831:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1911:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1911:29: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::__cxx11::basic_string<char>::const_iterator'
1911 | insert(const_iterator __p, initializer_list<_CharT> __l)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/basic_string.h:1939:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1939 | insert(size_type __pos1, const basic_string& __str)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1939:52: note: no known conversion for argument 2 from 'char' to 'const std::__cxx11::basic_string<char>&'
1939 | insert(size_type __pos1, const basic_string& __str)
| ~~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&, size_type, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1963 | insert(size_type __pos1, const basic_string& __str,
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1963:7: note: candidate expects 4 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, const _CharT*, size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
1987 | insert(size_type __pos, const _CharT* __s, size_type __n)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:1987:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(size_type, size_type, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
2032 | insert(size_type __pos, size_type __n, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2032:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/basic_string.h:2051:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::iterator std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::insert(__const_iterator, _CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; iterator = std::__cxx11::basic_string<char>::iterator; __const_iterator = std::__cxx11::basic_string<char>::const_iterator]'
2051 | insert(__const_iterator __p, _CharT __c)
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:2051:31: note: no known conversion for argument 1 from 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} to 'std::__cxx11::basic_string<char>::__const_iterator' {aka 'std::__cxx11::basic_string<char>::const_iterator'}
2051 | insert(__const_iterator __p, _CharT __c)
| ~~~~~~~~~~~~~~~~~^~~
|
s450066959
|
p04001
|
C++
|
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=a;i<b;i++)
using namespace std;
using ll = long long;
int main() {
string s;
ll ans=sum=0;
cin>>s;
rep(i, 0, 1 << s.size()-1) {
rep(j, 0, s.size()) {
if (1 & i >> j)sum = sum*10 + (int)(s[j] - '0');
else ans += sum * 10 + (int)(s[j] - '0'),sum=0;
}
}
cout<<ans<<endl;
}
|
a.cc: In function 'int main()':
a.cc:7:16: error: 'sum' was not declared in this scope
7 | ll ans=sum=0;
| ^~~
|
s337041261
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
stack<int> d;
int i;
int dfs(a){
if(i==d.size()) return a;
return dfs(a*10+d[i+1])+a+dfs(d[i+1]);
}
int main(){
long long s;
cin>>s;
for(int j=0;j<10;j++){
if(s%10==0)break;
d.push(s%10);
s/=10;
}
reverse(d.begin(),d.end());
cout<<dfs(d[0])<<endl;
}
|
a.cc:5:9: error: 'a' was not declared in this scope
5 | int dfs(a){
| ^
a.cc: In function 'int main()':
a.cc:17:13: error: 'class std::stack<int>' has no member named 'begin'
17 | reverse(d.begin(),d.end());
| ^~~~~
a.cc:17:23: error: 'class std::stack<int>' has no member named 'end'
17 | reverse(d.begin(),d.end());
| ^~~
a.cc:18:14: error: no match for 'operator[]' (operand types are 'std::stack<int>' and 'int')
18 | cout<<dfs(d[0])<<endl;
| ^
a.cc:18:17: error: 'dfs' cannot be used as a function
18 | cout<<dfs(d[0])<<endl;
| ^
|
s956111754
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
stack<int> d;
int i;
int dfs(a){
if(i==d.size()) return a;
return dfs(a*10+d[i+1])+a+dfs(d[i+1]);
}
int main(){
int s;
cin>>s;
stack<int> d;
for(int j=0;j<10;j++){
if(s%10==0)break;
d.push(s%10);
s/=10;
}
reverse(d.begin(),d.end());
cout<<dfs(d[0])<<endl;
}
|
a.cc:5:9: error: 'a' was not declared in this scope
5 | int dfs(a){
| ^
a.cc: In function 'int main()':
a.cc:18:13: error: 'class std::stack<int>' has no member named 'begin'
18 | reverse(d.begin(),d.end());
| ^~~~~
a.cc:18:23: error: 'class std::stack<int>' has no member named 'end'
18 | reverse(d.begin(),d.end());
| ^~~
a.cc:19:14: error: no match for 'operator[]' (operand types are 'std::stack<int>' and 'int')
19 | cout<<dfs(d[0])<<endl;
| ^
a.cc:19:17: error: 'dfs' cannot be used as a function
19 | cout<<dfs(d[0])<<endl;
| ^
|
s636077968
|
p04001
|
C++
|
include<iostream>
#include <bits/stdc++.h>
using namespace std;
int ctoi(int x){
if(x == '0'){
return 0;}
if(x == '1'){
return 1;}
if(x == '2'){
return 2;}
if(x == '3'){
return 3;}
if(x == '4'){
return 4;}
if(x == '5'){
return 5;}
if(x =='6'){
return 6;}
if(x == '7'){
return 7;}
if (x == '8'){
return 8;}
if (x == '9'){
return 9;}
}
int main(){
string S;
cin >> S;
int sum = 0;
vector<int>vec(0);
for(int i = 0; i<S.size();i++){
vec.push_back(ctoi(S.at(i)));
}
int a = 0;
for(int i =0; i< 1<<S.size()-1; i++){
for(int j = 0; j<S.size()-1; j++){
if((i >> j) & 1){
a = a*10 + vec.at(j);
sum = sum + a;
a = 0;
if(j == S.size()-2){
a = vec.at(S.size()-1);
sum = sum + a;
a =0;
}
}
else{
a = a*10 + vec.at(j);
if(j == S.size()-2){
a = a*10+ vec.at(S.size()-1);
sum = sum + a;
a =0;
}
}
}
}
cout << sum << endl;
}
|
a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/cstddef:50,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:41:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'; did you mean 'nullptr_t'?
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:443:29: note: 'nullptr_t' declared here
443 | typedef decltype(nullptr) nullptr_t;
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:2086:26: error: 'std::size_t' has not been declared
2086 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2087:30: error: '_Size' was not declared in this scope
2087 | struct remove_extent<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2087:36: error: template argument 1 is invalid
2087 | struct remove_extent<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2099:26: error: 'std::size_t' has not been declared
2099 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:2100:35: error: '_Size' was not declared in this scope
2100 | struct remove_all_extents<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:2100:41: error: template argument 1 is invalid
2100 | struct remove_all_extents<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:2171:12: error: 'std::size_t' has not been declared
2171 | template<std::size_t _Len>
| ^~~
/usr/include/c++/14/type_traits:2176:30: error: '_Len' was not declared in this scope
2176 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2194:12: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2194:30: error: 'std::size_t' has not been declared
2194 | template<std::size_t _Len, std::size_t _Align =
| ^~~
/usr/include/c++/14/type_traits:2195:55: error: '_Len' was not declared in this scope
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^~~~
/usr/include/c++/14/type_traits:2195:59: error: template argument 1 is invalid
2195 | __alignof__(typename __aligned_storage_msa<_Len>::__type)>
| ^
/usr/include/c++/14/type_traits:2202:30: error: '_Len' was not declared in this scope
2202 | unsigned char __data[_Len];
| ^~~~
/usr/include/c++/14/type_traits:2203:44: error: '_Align' was not declared in this scope
2203 | struct __attribute__((__aligned__((_Align)))) { } __align;
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_tempbuf.h:59,
from /usr/include/c++/14/bits/stl_algo.h:69,
from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
|
|
s684038721
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int a;
cin>>a;
int dfs (int i, int sum){
if (a/i==0)return sum;
else{
sum+=dfs(10,a/i)
sum+=dfs(10*i,a)
}
}
int main(){
cout<<dfs(10,0)<<endl;
}
|
a.cc:4:1: error: 'cin' does not name a type
4 | cin>>a;
| ^~~
a.cc: In function 'int dfs(int, int)':
a.cc:8:21: error: expected ';' before 'sum'
8 | sum+=dfs(10,a/i)
| ^
| ;
9 | sum+=dfs(10*i,a)
| ~~~
a.cc:8:8: warning: control reaches end of non-void function [-Wreturn-type]
8 | sum+=dfs(10,a/i)
| ~~~^~~~~~~~~~~~~
|
s553607391
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int a;
cin>>a;
int dfs (int i, ){
if (a/i==0)return sum;
else{
sum+=dfs(10,a/i)
sum+=dfs(10*i,a)
}
}
int main(){
cout<<dfs(10,0)<<endl;
}
|
a.cc:4:1: error: 'cin' does not name a type
4 | cin>>a;
| ^~~
a.cc:5:17: error: expected identifier before ')' token
5 | int dfs (int i, ){
| ^
a.cc: In function 'int dfs(int, int)':
a.cc:6:21: error: 'sum' was not declared in this scope
6 | if (a/i==0)return sum;
| ^~~
a.cc:8:5: error: 'sum' was not declared in this scope
8 | sum+=dfs(10,a/i)
| ^~~
|
s344646810
|
p04001
|
C++
|
s = input()
space = len(s) - 1
ans = 0
for i in range(2 ** space):
formula = s[0]
for j in range(space):
if (i >> j) & 1:
formula += "+"
formula += s[j + 1]
ans += eval(formula)
print(ans)
|
a.cc:1:1: error: 's' does not name a type
1 | s = input()
| ^
|
s670488109
|
p04001
|
C++
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace algorithm
{
class Program
{
static void Main(string[] args)
{
char[] c = Console.ReadLine().ToCharArray();
char[] d = new char[c.Length * 2];
char[] tmp = new char[c.Length * 2];
int[] calc = new int[c.Length-1];
long sum = 0;
//初期化
calc = Array.ConvertAll(calc, x => x = 0);
for (int i = 0; i < c.Length; i++)
{
d[i * 2] = c[i];
d[i * 2 + 1] = ' ';
}
for (int i = 0; i < 1 << calc.Length; i++)
{
Array.Copy(d, tmp,d.Length);
StringBuilder sb = new StringBuilder();
sb.Append(c[0]);
for (int j = 0; j < calc.Length; j++)
{
//iを右シフトして最下位ビットをチェック
if ((i >> j & 1) == 1)
{
sb.Append("+");
}
sb.Append(c[j+1]);
}
sum += sb.ToString().Split('+').Select(x => long.Parse(x)).ToArray().Sum();
}
Console.WriteLine(sum);
}
}
}
|
a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:2:7: error: expected nested-name-specifier before 'System'
2 | using System.Collections.Generic;
| ^~~~~~
a.cc:3:7: error: expected nested-name-specifier before 'System'
3 | using System.Linq;
| ^~~~~~
a.cc:4:7: error: expected nested-name-specifier before 'System'
4 | using System.Text;
| ^~~~~~
a.cc:11:34: error: 'string' has not been declared
11 | static void Main(string[] args)
| ^~~~~~
a.cc:11:43: error: expected ',' or '...' before 'args'
11 | static void Main(string[] args)
| ^~~~
a.cc:50:10: error: expected ';' after class definition
50 | }
| ^
| ;
a.cc: In static member function 'static void algorithm::Program::Main(int*)':
a.cc:14:29: error: structured binding declaration cannot have type 'char'
14 | char[] c = Console.ReadLine().ToCharArray();
| ^~
a.cc:14:29: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:14:29: error: empty structured binding declaration
a.cc:14:32: error: expected initializer before 'c'
14 | char[] c = Console.ReadLine().ToCharArray();
| ^
a.cc:15:29: error: structured binding declaration cannot have type 'char'
15 | char[] d = new char[c.Length * 2];
| ^~
a.cc:15:29: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:15:29: error: empty structured binding declaration
a.cc:15:32: error: expected initializer before 'd'
15 | char[] d = new char[c.Length * 2];
| ^
a.cc:16:29: error: structured binding declaration cannot have type 'char'
16 | char[] tmp = new char[c.Length * 2];
| ^~
a.cc:16:29: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:16:29: error: empty structured binding declaration
a.cc:16:32: error: expected initializer before 'tmp'
16 | char[] tmp = new char[c.Length * 2];
| ^~~
a.cc:17:28: error: structured binding declaration cannot have type 'int'
17 | int[] calc = new int[c.Length-1];
| ^~
a.cc:17:28: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:17:28: error: empty structured binding declaration
a.cc:17:31: error: expected initializer before 'calc'
17 | int[] calc = new int[c.Length-1];
| ^~~~
a.cc:20:25: error: 'calc' was not declared in this scope
20 | calc = Array.ConvertAll(calc, x => x = 0);
| ^~~~
a.cc:20:32: error: 'Array' was not declared in this scope
20 | calc = Array.ConvertAll(calc, x => x = 0);
| ^~~~~
a.cc:20:55: error: 'x' was not declared in this scope
20 | calc = Array.ConvertAll(calc, x => x = 0);
| ^
a.cc:20:58: error: expected primary-expression before '>' token
20 | calc = Array.ConvertAll(calc, x => x = 0);
| ^
a.cc:22:45: error: 'c' was not declared in this scope
22 | for (int i = 0; i < c.Length; i++)
| ^
a.cc:24:33: error: 'd' was not declared in this scope
24 | d[i * 2] = c[i];
| ^
a.cc:30:44: error: 'd' was not declared in this scope
30 | Array.Copy(d, tmp,d.Length);
| ^
a.cc:30:47: error: 'tmp' was not declared in this scope
30 | Array.Copy(d, tmp,d.Length);
| ^~~
a.cc:31:33: error: 'StringBuilder' was not declared in this scope
31 | StringBuilder sb = new StringBuilder();
| ^~~~~~~~~~~~~
a.cc:32:33: error: 'sb' was not declared in this scope
32 | sb.Append(c[0]);
| ^~
a.cc:32:43: error: 'c' was not declared in this scope
32 | sb.Append(c[0]);
| ^
a.cc:44:75: error: expected primary-expression before '>' token
44 | sum += sb.ToString().Split('+').Select(x => long.Parse(x)).ToArray().Sum();
| ^
a.cc:44:77: error: expected primary-expression before 'long'
44 | sum += sb.ToString().Split('+').Select(x => long.Parse(x)).ToArray().Sum();
| ^~~~
a.cc:46:25: error: 'Console' was not declared in this scope
46 | Console.WriteLine(sum);
| ^~~~~~~
|
s726230431
|
p04001
|
C++
|
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
#define repprev(i,a,b) for(ll i=b-1;i>=a;i--)
#define reprev(i,n) repprev(i,0,n)
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class T> int former(const vector<T> &v, T x){
return upper_bound(v.begin(),v.end(),x) - v.begin() - 1;
}
template<class T> int latter(const vector<T> &v, T x){
return lower_bound(v.begin(),v.end(),x) - v.begin();
}
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define BIT_FLAG_0 (1<<0) // 0000 0000 0000 0001
#define BIT_FLAG_1 (1<<1) // 0000 0000 0000 0010
#define BIT_FLAG_2 (1<<2) // 0000 0000 0000 0100
#define BIT_FLAG_3 (1<<3) // 0000 0000 0000 1000
#define BIT_FLAG_4 (1<<4) // 0000 0000 0001 0000
#define BIT_FLAG_5 (1<<5) // 0000 0000 0010 0000
#define BIT_FLAG_6 (1<<6) // 0000 0000 0100 0000
#define BIT_FLAG_7 (1<<7) // 0000 0000 1000 0000
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll INF = 1LL<<60;
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++){
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k){
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct UnionFind {
vector<ll> par; // par[i]:iの親の番号 (例) par[3] = 2 : 3の親が2
UnionFind(ll n) : par(n, -1) { }
void init(ll n) { par.assign(n, -1); }
ll root(ll x) {
if (par[x] < 0) return x;
else return par[x] = root(par[x]);
}
bool issame(ll x, ll y) {
return root(x) == root(y);
}
bool merge(ll x, ll y) {
x = root(x); y = root(y);
if (x == y) return false;
if (par[x] > par[y]) swap(x, y); // merge technique
par[x] += par[y];
par[y] = x;
return true;
}
ll size(ll x) {
return -par[root(x)];
}
};
template <typename T>
vector<T> dijkstra(int s,vector<vector<pair<int, T> > > & G){
const T INF = numeric_limits<T>::max();
using P = pair<T, int>;
int n=G.size();
vector<T> d(n,INF);
vector<int> b(n,-1);
priority_queue<P,vector<P>,greater<P> > q;
d[s]=0;
q.emplace(d[s],s);
while(!q.empty()){
P p=q.top();q.pop();
int v=p.second;
if(d[v]<p.first) continue;
for(auto& e:G[v]){
int u=e.first;
T c=e.second;
if(d[u]>d[v]+c){
d[u]=d[v]+c;
b[u]=v;
q.emplace(d[u],u);
}
}
}
return d;
}
const int dx[4] = {1, 0, -1, 0}; // const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[4] = {0, 1, 0, -1}; // const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int main(){
string s;
cin >> s;
// bit全探索テンプレート
int n = s.size()-1;
// {0, 1, ..., n-1} の部分集合の全探索
for (int bit = 0; bit < (1<<n); ++bit)
{
/* bit で表される集合の処理を書く */
int sum = 0;
/* きちんとできていることを確認してみる */
// bit の表す集合を求める
for (int i = 0; i < n; ++i) {
if (bit & (1<<i)) { // i が bit に入るかどうか
sum += (int)s[i];
}
}
}
cout << sum << endl;
}
|
a.cc: In function 'int main()':
a.cc:141:17: error: 'sum' was not declared in this scope
141 | cout << sum << endl;
| ^~~
|
s042530167
|
p04001
|
C++
|
#include <cstdlib>
using namespace std;
typedef long long ll;
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
int main() {
string S; cin >> S;
int N = S.size();
ll ans = 0;
FOR(bit, 0, (1<<(N - 1))) {
ll sum = 0;
int x = 0;
FOR(i, 0, N - 1) {
if (bit & (1<<i)) {
ll y = atoi(S.substr(x,i - x + 1).c_str());
sum += y;
x = i + 1;
}
}
ll z = atoi(S.substr(x).c_str());
sum += z;
ans += sum;
}
printf("%d\n", ans);
}
|
a.cc: In function 'int main()':
a.cc:8:5: error: 'string' was not declared in this scope
8 | string S; cin >> S;
| ^~~~~~
a.cc:2:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <cstdlib>
+++ |+#include <string>
2 | using namespace std;
a.cc:8:15: error: 'cin' was not declared in this scope
8 | string S; cin >> S;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <cstdlib>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:8:22: error: 'S' was not declared in this scope
8 | string S; cin >> S;
| ^
a.cc:29:5: error: 'printf' was not declared in this scope
29 | printf("%d\n", ans);
| ^~~~~~
a.cc:2:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
1 | #include <cstdlib>
+++ |+#include <cstdio>
2 | using namespace std;
|
s257120299
|
p04001
|
C++
|
#include <vector>
#include <list>
#include <map>
#include <set>//2分探索木
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>// キュー 優先度付きキュー
#include <stack>
#include <complex>
#include <assert.h>
#ifdef LOCAL
#include "UnionFind.h"//同じグループに属するか
#include "Prime.h"//素数判定
#include "RMQ.h"//区間最小値
#include "BIT.h"//累積和
#endif
using namespace std;
//conversion
//------------------------------------------
inline long long toInt(string s) { long long v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<PII> VPII;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(t,a,b) for(int t=(a);t<(b);++t)
#define REP(t,n) FOR(t,0,n)
//constant
//------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
//clear memory
//------------------------------------------
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
//------------------------------------------
#if defined(__GNUC__)
#include <assert.h>
#define ASSERT_(x) assert(x)
#else
#include <assert.h>
#define ASSERT_(x) assert(x)
#endif
#ifdef _DEBUG
#define dump(x) cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;
#define ASSERT(x) {if (!(x)){std::cerr << "\nError!!\n" << "info string file:" << __FILE__ << " line:" << __LINE__ <<" "<< #x<< std::endl;ASSERT_(x);}}
#else
#define ASSERT(x) ((void)0)
#define debug(x) ((void)0)
#define dump(x) ((void)0)
#endif // _DEBUG
//mod
//-------------------------------------------
const LL mod = 1000000007;
LL mod_pow(LL x, LL n, LL mod) {
if (n == 0) { return 1; }
LL res = mod_pow(x * x % mod, n / 2, mod);
if (n & 1) { res = res * x % mod; }
return res;
}
//gcd lcm
//-------------------------------------------
LL gcd(LL a, LL b) { if (a%b == 0) { return b; } else return gcd(b, a%b); }
LL lcm(LL a, LL b) { return a / gcd(a, b)*b; }
//YES_NO
//------------------------------------------
#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;
#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;
#define POSSIBLE cout<<"POSSIBLE"<<endl; return 0;
#define IMPOSSIBLE cout<<"IMPOSSIBLE"<<endl; return 0;
//matrix
//------------------------------------------
template <class T> class matrix : public vector< vector<T> > {
private:
int tate_, yoko_;
public:
matrix(const int tate__, const int yoko__) {
ASSERT(tate__ > 0); ASSERT(yoko__ > 0);
this->resize(tate__);
for (size_t i = 0; i < this->size(); i++) { (*this)[i].resize(yoko__); }
tate_ = tate__; yoko_ = yoko__;
}
matrix() {};
int tate()const { return tate_; }
int yoko()const { return yoko_; }
void resizematrix(const int tate__, const int yoko__) {
ASSERT(tate__ > 0); ASSERT(yoko__ > 0);
this->resize(tate__);
for (size_t i = 0; i < this->size(); i++) {
(*this)[i].resize(yoko__);
}
tate_ = tate__; yoko_ = yoko__;
}
void setone() {for (int i = 0; i < tate(); i++) for (int j = 0; j < yoko(); j++) { (*this)[i][j] = 1; }}
void setzero() {for (int i = 0; i < tate(); i++) for (int j = 0; j < yoko(); j++) { (*this)[i][j] = 0; }}
void setAll(T a) {for (int i = 0; i < tate(); i++) for (int j = 0; j < yoko(); j++) { (*this)[i][j] = a; }}
};
template<class T> std::ostream& operator<<(std::ostream& os, const matrix<T>& m)
{
for (int j = 0; j < m.tate(); j++) {
for (int i = 0; i < m.yoko(); i++) {
os << (int)m[j][i];
}
os << endl;
}
return os;
}
//time
//------------------------------------------
#if defined(__GNUC__)
#include <sys/time.h>
#include <immintrin.h>
#include <string.h>
LL starttime;
inline LL now() {
struct timeval tv;
gettimeofday(&tv, NULL);
LL t = tv.tv_sec * 1000LL + tv.tv_usec / 1000LL;
return t;
}
inline LL elapsed() { return now() - starttime; }
#else
#include <chrono>
#include <intrin.h>
typedef std::chrono::milliseconds::rep TimePoint;
inline TimePoint now() { return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now().time_since_epoch()).count(); }
TimePoint starttime;
inline TimePoint elapsed() { return now() - starttime; }
#endif
//=====================================================
int main() {
//10文字なので9箇所に+を入れることが出来る
string S;
cin >> S;
int a = 0;
string b = "";
LL ans = 0LL;
for (; a < (1 << (SZ(S)-1)); a++) {
vector<LL> s;
for (int i = 0; i < SZ(S);i++) {
b += S[i];
if ((a & (1 << i)) != 0) {
dump(b);
s.PB(toInt(b)); b = "";
}
}
if (b != "") { dump(b); ans += toInt(b); b = ""; }
for (auto kk : s) {
ans += kk;
}
dump("------------------------------")
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:212:9: error: expected ';' before '}' token
212 | }
| ^
|
s713092332
|
p04001
|
C++
|
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <string>
using namespace std;
char C[10];
int S[10];
int len;
int calc(int acc, int pos, int last, int delimiter) {
if (delimiter == len) {
return 0;
}
if (pos == len - 1) {
auto after = 0;
for (auto i = last; i < len; i++) {
after = after * 10 + S[i];
}
return acc + after;
} else {
auto before = 0;
for (auto i = last; i <= pos; i++) {
before = before * 10 + S[i];
}
return calc(acc + before, pos + 1, pos + 1, delimiter + 1) +
calc(acc, pos + 1, last, delimiter);
}
}
int main() {
scanf("%s\n", C);
len = (int)strlen(C);
for (auto i = 0; i < len; i++)
S[i] = C[i] - '0';
printf("%d\n", calc(0, 0, 0, 0));
return 0;
}
|
a.cc: In function 'int main()':
a.cc:36:14: error: 'strlen' was not declared in this scope
36 | len = (int)strlen(C);
| ^~~~~~
a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <iostream>
+++ |+#include <cstring>
5 | #include <string>
|
s720247819
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main() {
//bit全探索を用いる
string S;
cin >> S;
long long int ans = 0;
for (int bit = 0; bit < (1<<(S.size()-1)); bit++;) { // Sの部分集合の全探索 (数と数の間について+が入るかどうかを全列挙)
int s = 0; //考えている現在地
for (int i=0; i<S.size()-1; i++) {
if (bit & (1 << i)) { //iがbitに入るかどうか
ans += stoll(S.substr(s, i - s + 1)); //+が入る部分までを加える
s = i + 1; //+が入る位置の右隣まで現在地を進める
}
}
ans += stoll(S.substr(s, S.size() - s));//最後に+が入った位置から最後の数字までを加える
}
cout << ans << endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:9:51: error: expected ')' before ';' token
9 | for (int bit = 0; bit < (1<<(S.size()-1)); bit++;) { // Sの部分集合の全探索 (数と数の間について+が入るかどうかを全列挙)
| ~ ^
| )
a.cc:9:52: error: expected primary-expression before ')' token
9 | for (int bit = 0; bit < (1<<(S.size()-1)); bit++;) { // Sの部分集合の全探索 (数と数の間について+が入るかどうかを全列挙)
| ^
|
s050241443
|
p04001
|
C
|
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>
using namespace std;
typedef long long unsigned int ll;
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define amari (x) x % 1000000007;
#define fillInt(xs, x) \
for (int i = 0; i < x; i++) \
scanf("%d", &xs[i]);
#define fillLong(xs, x) \
for (int i = 0; i < x; i++) \
scanf("%ld", &xs[i]);
#define sortv(xs) sort(xs.begin(), xs.end());
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>());
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin();
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin();
long calc(string h, string rem, long res) {
if (rem.empty() && h.empty()) return res;
if (rem.empty()) return 0;
string newH = h + rem.substr(0, 1);
string newRem = rem.substr(1);
long left = calc("", newRem, res + stol(newH));
long right = calc(newH, newRem, res);
return left + right;
}
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
string S;
cin >> S;
printf("%ld", calc("", S, 0L));
return 0;
}
|
main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s204324821
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main(void){
string s; cin>>s;
long int bit,i,n,sum=0; n=s.size()-1; //125でn=2
for(bit=0;bit<(1<<n);bit++){
string str=s; int x=0;
for(i=0;i<n;i++){
string tmp;
if(bit&(1<<i)){
tmp=str.substr(x,i-1);
sum+=long(tmp);
x=i;
}
}
string tmp;
tmp=str.substr(x,str.size());
if(tmp.size()==1) sum+=tmp[0]-'0'; else
sum+=stoll(tmp);
}
cout <<sum<<endl;
}
|
a.cc: In function 'int main()':
a.cc:13:22: error: invalid cast from type 'std::string' {aka 'std::__cxx11::basic_string<char>'} to type 'long int'
13 | sum+=long(tmp);
| ^~~~~~~~~
|
s961725106
|
p04001
|
C++
|
S = input()
op_cnt = len(S) - 1
ResSum = 0
for i in range(2**op_cnt):
op = [""] * op_cnt
for j in range(op_cnt):
if((i >> j) & 1):
op[op_cnt - 1 - j] = "+"
formula = ""
for p_S, p_o in zip(S, op + [""]):
formula += (p_S + p_o)
ResSum += eval(formula)
print(ResSum)
|
a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s077543599
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int number[S.size()];
for(int i=0;i<S.size();i++){
number[i] = S%10;
S /= 10;
}
int ans = 0;
for(int i=0;i<(1<<S.size());i++){
int temp = i;
int factor = 1;
ans += (number[0])
for(int j=1;j<S.size();j++){
if(temp&0b1){
factor = 1;
}else{
factor *= 10;
}
temp >>= 1;
ans += (number[j]*factor);
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:15:18: error: no match for 'operator%' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
15 | number[i] = S%10;
| ~^~~
| | |
| | int
| std::string {aka std::__cxx11::basic_string<char>}
a.cc:16:7: error: no match for 'operator/=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'int')
16 | S /= 10;
| ~~^~~~~
a.cc:24:23: error: expected ';' before 'for'
24 | ans += (number[0])
| ^
| ;
25 | for(int j=1;j<S.size();j++){
| ~~~
a.cc:25:17: error: 'j' was not declared in this scope
25 | for(int j=1;j<S.size();j++){
| ^
|
s094519119
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
int temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (stoi(S[j])*factor);
factor*=10;
j-=1;
if(temp&0b1) {factor=1;}
temp = (temp>>1);
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:19: error: no matching function for call to 'stoi(__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type&)'
20 | ans += (stoi(S[j])*factor);
| ~~~~^~~~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::string&' {aka 'const std::__cxx11::basic_string<char>&'}
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4432:3: note: candidate: 'int std::__cxx11::stoi(const std::wstring&, std::size_t*, int)'
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4432:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'}
4432 | stoi(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
|
s926829422
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
int temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (atoi(S[j])*factor);
factor*=10;
j-=1;
if(temp&0b1) {factor=1;}
temp = (temp>>1);
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:20:19: error: invalid conversion from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'} to 'const char*' [-fpermissive]
20 | ans += (atoi(S[j])*factor);
| ~~~~^~~~~~
| |
| __gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type {aka char}
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/ext/string_conversions.h:43,
from /usr/include/c++/14/bits/basic_string.h:4154,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)'
105 | extern int atoi (const char *__nptr)
| ~~~~~~~~~~~~^~~~~~
|
s304708261
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
int temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (S[j]*factor);
factor*=10;
j-=1;
if(temp&0b1) {factor=1;}
temp = (temp>>1);
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:23: error: expected ';' before '\U0000ff1b'
24 | temp = (temp>>1);
| ^~
| ;
|
s048462733
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
int temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (S[j]*factor);
factor*=10;
j-=1;
if(temp&0b1) factor=1;
temp = (temp>>1);
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:23: error: expected ';' before '\U0000ff1b'
24 | temp = (temp>>1);
| ^~
| ;
|
s076155128
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
int temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (S[j]*factor);
factor*=10;
j-=1;
if(temp&0b1) factor=1;
temp = temp>>1;
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:24:20: error: unable to find numeric literal operator 'operator""\U0000ff1b'
24 | temp = temp>>1;
| ^~~
|
s087354890
|
p04001
|
C++
|
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
int main() {
string S;
cin >> S;
int ans = 0;
for(int i=0;i<(1<<(S.size()-1));i++){
temp = i+(1<<S.size());
int factor = 1;
int j =S.size()-1;
while(temp){
ans += (S[j]*factor);
factor*=10;
j-=1;
if(temp&0b1) factor=1;
temp = temp>>1;
}
}
cout << ans << endl;
}
|
a.cc: In function 'int main()':
a.cc:16:5: error: 'temp' was not declared in this scope; did you mean 'tm'?
16 | temp = i+(1<<S.size());
| ^~~~
| tm
a.cc:24:20: error: unable to find numeric literal operator 'operator""\U0000ff1b'
24 | temp = temp>>1;
| ^~~
|
s358510153
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define all(x) (x).begin(),(x).end()
#define foreach(u,v) for(auto (u) : (v))
#define pb push_back
#define mp make_pair
#define mt make_tuple
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
const int inf = 1e9;
const ll linf = 1LL<<60;
const ll mod = 1e9 + 7;
const double eps = 1e-9;
/*
*/
typedef tuple<int, int, int> triple;
int n, m;
unordered_map<pii, vector<triple>> g;
unordered_map<pii, ll> dist;
int main()
{
cin >> n >> m;
rep(i, m){
int p, q, c;
cin >> p >> q >> c;
p--; q--;
g[mp(p, c)].pb(mt(q, c, 0));
g[mp(q, c)].pb(mt(p, c, 0));
g[mp(p, c)].pb(mt(q, -1, 0));
g[mp(q, c)].pb(mt(p, -1, 0));
g[mp(p, -1)].pb(mt(q, c, 1));
g[mp(q, -1)].pb(mt(p, c, 1));
dist[mp(p, c)] = linf;
dist[mp(q, c)] = linf;
dist[mp(p, -1)] = linf;
dist[mp(q, -1)] = linf;
}
rep(i, n) dist[mp(i, -1)] = linf;
priority_queue<triple, vector<triple>, greater<triple>> que;
que.push(mt(0, 0, -1));
dist[mp(0, -1)] = 0;
while(!que.empty()){
int d, v, c;
tie(d, v, c) = que.top();
que.pop();
if(dist[mp(v, c)] < d) continue;
for(auto e : g[mp(v, c)]){
int to, cc, dd;
tie(to, cc, dd) = e;
if(dist[mp(to, cc)] > dist[mp(v, c)] + dd){
dist[mp(to, cc)] = dist[mp(v, c)] + dd;
que.push(mt(dist[mp(to, cc)], to, cc));
}
}
}
ll ans = dist[mp(n-1, -1)];
if(ans == linf) cout << -1 << endl;
else cout << ans << endl;
return 0;
}
|
a.cc:36:36: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = std::vector<std::tuple<int, int, int> >; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > > >]'
36 | unordered_map<pii, vector<triple>> g;
| ^
In file included from /usr/include/c++/14/unordered_map:41,
from /usr/include/c++/14/functional:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = std::vector<std::tuple<int, int, int> >; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > > >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, std::vector<std::tuple<int, int, int> > >, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/i
|
s341106813
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
int main()
{
string S;
cin>>S;
int N = s.size();
int count = 0;
for(i=0;i<N;++i){
for(j=i;j<N;++j){
count += stoi(S.substr(i,j-i+1));
}
}
cout<<count<<endl;
}
|
a.cc: In function 'int main()':
a.cc:8:13: error: 's' was not declared in this scope
8 | int N = s.size();
| ^
a.cc:10:9: error: 'i' was not declared in this scope
10 | for(i=0;i<N;++i){
| ^
a.cc:11:13: error: 'j' was not declared in this scope
11 | for(j=i;j<N;++j){
| ^
|
s449415809
|
p04001
|
C++
|
import sys
inp = sys.stdin.readline
S = inp().replace('\n', '')
cnt = 0
for i in range(1 << len(S)-1):
tmp = S[0]
for j in range(len(S)-1):
if(((i >> j) & 1) == 1):
tmp += '+'
tmp += S[j+1]
cnt += sum(map(int, tmp.split('+')))
print(cnt)
|
a.cc:4:25: error: empty character constant
4 | S = inp().replace('\n', '')
| ^~
a.cc:1:1: error: 'import' does not name a type
1 | import sys
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s709824000
|
p04001
|
C++
|
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
typedef long long ll;
using namespace std;
int main(){
string s;
cin >> s;
ll ans = 0;
for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
ll num = s [0] -'0';
for(int i = 0; i <s.size() - 1; i ++){
如果(T&(1 << i))的{
ANS + = NUM;
NUM = 0;
}
NUM = NUM * 10 + S [I + 1] - '0';
}
ANS + = NUM;
}
cout << ans << endl;
返回0;
}
|
a.cc: In function 'int main()':
a.cc:19:3: error: 'for\U0000ff08int' was not declared in this scope
19 | for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
| ^~~~~~~~
a.cc:19:19: error: 't' was not declared in this scope
19 | for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
| ^
a.cc:19:22: error: '\U0000ff081' was not declared in this scope
19 | for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
| ^~~
a.cc:19:28: error: '\U0000ff08s' was not declared in this scope
19 | for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
| ^~~
a.cc:19:44: error: unable to find numeric literal operator 'operator""\U0000ff09\U0000ff09'
19 | for(int t = 0; t <(1 <<(s.size() - 1)); t ++){
| ^~~~~
a.cc:31:3: error: '\U00008fd4\U000056de0' was not declared in this scope
31 | 返回0;
| ^~~~~
|
s744884753
|
p04001
|
C++
|
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<map>
#include<numeric>
#include<set>
#include<string>
#include<utility>
#include<vector>
#define rep(i, a, n) for(int i=a; i<n; i++)
#define per(i, a, n) for(int i=n-1; i>=a; i--)
#define fill0(n) setfill('0') << right << setw(n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MAX 1000001
using namespace std;
typedef long long ll;
string s;
int main(){
std::cin >> s;
ll res = 0;
rep(i,0,(1<<s.size()-1)){
ll tmp = s[0]-'0';
rep(j,1,s.size()){
if(i&(1<<(j-1)){
res+=tmp;
tmp=0;
}
tmp*=10;
tmp+=s[j]-'0';
}
res+=tmp;
}
std::cout << res << '\n';
}
|
a.cc: In function 'int main()':
a.cc:29:22: error: expected ';' before '{' token
29 | if(i&(1<<(j-1)){
| ^
| ;
a.cc:33:14: error: expected ')' before ';' token
33 | tmp*=10;
| ^
| )
a.cc:29:9: note: to match this '('
29 | if(i&(1<<(j-1)){
| ^
|
s282693960
|
p04001
|
C++
|
import Control.Applicative
import Text.Printf
import Debug.Trace
solve :: [Integer] -> Integer
solve [] = 0
solve [x] = x
solve (x:xs) = x*(2^((length xs) - 1)) + (solve xs) + (solve ((10*x+(xs!!0)):(tail xs)))
solve_sub :: Int->[Integer] -> Integer
solve_sub n [] = 0
solve_sub n [x] = x*2^n
solve_sub n (x:xs) = x*(2^n)*10^(length xs) + (1-5^(length xs))`div`(1-5)*x*2^(length xs - 1 + n) + (solve_sub (n+1) xs)
solve_ :: [Integer] -> Integer
solve_ l = solve_sub 0 l
listize :: Integer->[Integer]
listize 0 = []
listize n = (listize $ n`div`10)++[(n`mod`10)]
main :: IO()
main = do
n <- readLn
-- O(2^N)
printf "%d\n" $ solve $ listize n
-- O(N)
--printf "%d\n" $ solve $ listize n
|
a.cc:13:64: error: stray '`' in program
13 | solve_sub n (x:xs) = x*(2^n)*10^(length xs) + (1-5^(length xs))`div`(1-5)*x*2^(length xs - 1 + n) + (solve_sub (n+1) xs)
| ^
a.cc:13:68: error: stray '`' in program
13 | solve_sub n (x:xs) = x*(2^n)*10^(length xs) + (1-5^(length xs))`div`(1-5)*x*2^(length xs - 1 + n) + (solve_sub (n+1) xs)
| ^
a.cc:20:25: error: stray '`' in program
20 | listize n = (listize $ n`div`10)++[(n`mod`10)]
| ^
a.cc:20:29: error: stray '`' in program
20 | listize n = (listize $ n`div`10)++[(n`mod`10)]
| ^
a.cc:20:38: error: stray '`' in program
20 | listize n = (listize $ n`div`10)++[(n`mod`10)]
| ^
a.cc:20:42: error: stray '`' in program
20 | listize n = (listize $ n`div`10)++[(n`mod`10)]
| ^
a.cc:1:1: error: 'import' does not name a type
1 | import Control.Applicative
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
|
s720440186
|
p04001
|
C++
|
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{int x,y,t;};
struct Edge{int to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
const ll Inf = llINF;const int MAX_V=1010;vector<ll>d;
Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
void add_edge(int from,int to,int cost){E[from-1].pb({to-1,cost});}
};
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int h,w,n;cin>>h>>w>>n;
int cnt[100]={};
vector<pair<int,int> >bl(n);
map<pair<int,int>,int>MP2;
for(int i=0;i<n;i++){
cin>>bl[i].F>>bl[i].S;
MP2[mp(bl[i].F,bl[i].S)]=1;
}
sort(ALL(bl));
map<pair<int,int>,int >MP;
for(int i=0;i<n;i++){
int jl=max(1,bl[i].F-2),jr=min(bl[i].F,h-2);
int kl=max(1,bl[i].S-2),kr=min(bl[i].S,w-2);
for(int j=jl;j<=jr;j++){
for(int k=kl;k<=kr;k++){
if(MP[mp(j,k)]==0){
MP[mp(j,k)]=1;
int cntt=0;
for(int l=j;l<=j+2:l++)
for(int ll=k;ll<=k+2;ll++)
cntt+=MP2[mp(l,ll)];
cnt[cntt]++;
}
}
}
}
int sum=0;
for(int i=1;i<=9;i++)sum+=cnt[i];
cout<<(ll)(h-2)*(w-2)-sum<<endl;
for(int i=1;i<=9;i++)cout<<cnt[i]<<endl;
return 0;
}
|
a.cc: In function 'int main()':
a.cc:44:23: warning: range-based 'for' loops with initializer only available with '-std=c++20' or '-std=gnu++20' [-Wc++20-extensions]
44 | for(int l=j;l<=j+2:l++)
| ^
a.cc:44:29: error: expected ';' before ':' token
44 | for(int l=j;l<=j+2:l++)
| ^
| ;
a.cc:45:28: error: expected unqualified-id before '<=' token
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
a.cc:10:12: error: expected primary-expression before 'long'
10 | #define ll long long
| ^~~~
a.cc:45:34: note: in expansion of macro 'll'
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
a.cc:45:34: error: expected ')' before 'long'
45 | for(int ll=k;ll<=k+2;ll++)
| ^
| )
a.cc:44:14: note: to match this '('
44 | for(int l=j;l<=j+2:l++)
| ^
a.cc:45:36: error: expected unqualified-id before '++' token
45 | for(int ll=k;ll<=k+2;ll++)
| ^~
|
s095215214
|
p04001
|
C++
|
S = input()
s = len(S)
n = 0
for i in range(s):
n+= int(S[i])*(10**(s-1-i))*2**i
lis = []
for i in range(s-1):
lis.append(2**i)
for i in range(s-1):
for j in range(s-1-i):
n += int(S[i])*(10**(s-2-i-j))*(lis[i+j])
print(n)
|
a.cc:1:1: error: 'S' does not name a type
1 | S = input()
| ^
|
s093055525
|
p04001
|
C++
|
#include <cstdio>
#include <cstring>
long long mypow(long long x, int n) {
long long ans=1;
for(int i=0; i<n; i++) {
ans *= x;
}
return ans;
}
int main() {
char s[11];
scanf("%s",s);
int len = strlen(s);
long long result=0, sum=0;
for (int cut=0; cut < len; cut++) {
for (int i=0; i < len; i++) {
if (i == cut) {
result += sum * mypow(2,len-cut-1);
sum = 0;
}
sum = 10*sum + (s[i]-'0');
}
result += sum * mypow(2,cut-1);
sum = 0;
}
printf("%lld\n",result);
return 0;
|
a.cc: In function 'int main()':
a.cc:28:14: error: expected '}' at end of input
28 | return 0;
| ^
a.cc:11:12: note: to match this '{'
11 | int main() {
| ^
|
s807073958
|
p04001
|
C++
|
if __name__=='__main__':
S=input()
sums=0
num=[x for x in range(1,len(S))]
for i in range(0,1<<len(num)):
output=[]
for j in range(len(num)):
if ((i>>j)&1)==1:
output.append(num[j])
output.append(10)
t=0
for o in output:
sums+=int(S[t:o])
t=o
print(sums)
|
a.cc:1:14: warning: multi-character literal with 8 characters exceeds 'int' size of 4 bytes
1 | if __name__=='__main__':
| ^~~~~~~~~~
a.cc:1:1: error: expected unqualified-id before 'if'
1 | if __name__=='__main__':
| ^~
|
s904405253
|
p04001
|
C++
|
#include <stdio.h>
#include <string.h>
long calc(char *target) {
long ans = 0;
char *p = strtok(target, "+");
while(p) {
ans += atol(p);
p = strtok(NULL, "+");
}
return ans;
}
main() {
char S[21];
scanf("%s", S);
int i;
int n = strlen(S);
char target[41];
int j;
long ans = 0;
for(i=0;i< 1<< (n - 1); i++) {
strcpy(target ,S);
int target_pos = 0;
for(j=0;j<n;j++) {
target[target_pos++] = S[j];
if( ((i >> j) & 1) == 1) {
target[target_pos++] = '+';
}
}
target[target_pos] = '\0';
ans += calc(target);
}
printf("%ld\n", ans);
}
|
a.cc: In function 'long int calc(char*)':
a.cc:8:24: error: 'atol' was not declared in this scope
8 | ans += atol(p);
| ^~~~
a.cc: At global scope:
a.cc:14:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
14 | main() {
| ^~~~
|
s715994784
|
p04001
|
C++
|
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s; cin >> s;
int t = atoi("s");
int a = s.size();
int count = 0;
for(int i = 0; i < a; ++i){
count += atoi(s[0:i]) + atoi(s[i:a - 1]);
}
cout << count << endl;
}
|
a.cc: In function 'int main()':
a.cc:11:22: error: expected ']' before ':' token
11 | count += atoi(s[0:i]) + atoi(s[i:a - 1]);
| ^
| ]
a.cc:11:22: error: expected ')' before ':' token
11 | count += atoi(s[0:i]) + atoi(s[i:a - 1]);
| ~ ^
| )
|
s391527030
|
p04001
|
C++
|
#include <cstdio>
#include <cmath>
int calc(int left, int sum) {
if (left < 10) {
return sum + left;
}
else {
sum += left;
for(int i=1;i < log10(left)+1;i++){
int right = left % (int) pow(10,i);
left = left / pow(10,i);
sum += calc(left,0)+calc(right,0);
}
return sum;
}
}
void solve() {
char S;
int iS;
scanf(" %c", &S);
iS = (int)S;
printf("%d\n", calc(iS, 0));
}
|
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s279088471
|
p04001
|
C++
|
#define CATCH_CONFIG_MAIN
#include <cstdio>
#include <cmath>
int calc(int left, int sum) {
if (left < 10) {
return sum + left;
}
else {
sum += left;
for(int i=1;i < log10(left)+1;i++){
int right = left % (int) pow(10,i);
left = left / pow(10,i);
sum += calc(left,0)+calc(right,0);
}
return sum;
}
}
void solve() {
char S;
int iS;
scanf(" %c", &S);
iS = (int)S;
printf("%d\n", calc(iS, 0));
}
|
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s904839109
|
p04001
|
C++
|
// https://qiita.com/drken/items/e77685614f3c6bf86f44
// https://,0)arc061.contest.atcoder.jp/tasks/arc061_a
#define CATCH_CONFIG_MAIN
#include <cstdio>
#include <cmath>
#include <catch2/catch.hpp>
int calc(int left, int sum) {
if (left < 10) {
return sum + left;
}
else {
sum += left;
for(int i=1;i < log10(left)+1;i++){
int right = left % (int) pow(10,i);
left = left / pow(10,i);
sum += calc(left,0)+calc(right,0);
}
return sum;
}
}
void solve() {
char S;
int iS;
scanf(" %c", &S);
iS = (int)S;
printf("%d\n", calc(iS, 0));
}
|
a.cc:6:10: fatal error: catch2/catch.hpp: No such file or directory
6 | #include <catch2/catch.hpp>
| ^~~~~~~~~~~~~~~~~~
compilation terminated.
|
s698767510
|
p04001
|
C++
|
#include <iostream>
#include <stdint.h>
using namespace std;
uint64_t test(uint64_t x, char *s) {
if (*s == '\0') {
return x;
}
uint64_t i = x + atoll(s);
for(int j = 1; j < strlen(s); j++) {
char tmp[j + 1];
memcpy(tmp, s, j);
tmp[j] = '\0';
i += test(x + atoll(tmp), s + j);
}
return i;
}
int main() {
char s[11];
cin >> s;
cout << test(0, s);
return 0;
}
|
a.cc: In function 'uint64_t test(uint64_t, char*)':
a.cc:10:22: error: 'strlen' was not declared in this scope
10 | for(int j = 1; j < strlen(s); j++) {
| ^~~~~~
a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <stdint.h>
+++ |+#include <cstring>
3 | using namespace std;
a.cc:12:5: error: 'memcpy' was not declared in this scope
12 | memcpy(tmp, s, j);
| ^~~~~~
a.cc:12:5: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
|
s310667637
|
p04001
|
C++
|
Last login: Tue Sep 11 13:04:54 on ttys000
Kosuke-no-MacBook-Pro:~ Kosuke$ cd Atcorder
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ emacs
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ g++ -o a abc079c.cpp
abc079c.cpp:11:29: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:33: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:35: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:39: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:41: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:45: error: expected ';' after expression
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
;
abc079c.cpp:11:51: error: reference to overloaded function could not be
resolved; did you mean to call it?
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:1032:1: note:
possible target for call
endl(basic_ostream<_CharT, _Traits>& __os)
^
abc079c.cpp:11:30: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^~~
abc079c.cpp:11:34: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
abc079c.cpp:11:36: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^~~
abc079c.cpp:11:40: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^
abc079c.cpp:11:42: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a "+" b "+" c "+" d << endl;
^~~
5 warnings and 7 errors generated.
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ g++ -o a abc079c.cpp
abc079c.cpp:11:29: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:33: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:35: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:39: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:41: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:45: error: expected ';' after expression
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
;
abc079c.cpp:11:51: error: reference to overloaded function could not be
resolved; did you mean to call it?
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ostream:1032:1: note:
possible target for call
endl(basic_ostream<_CharT, _Traits>& __os)
^
abc079c.cpp:11:30: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^~~
abc079c.cpp:11:34: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
abc079c.cpp:11:36: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^~~
abc079c.cpp:11:40: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^
abc079c.cpp:11:42: warning: expression result unused [-Wunused-value]
if(a+b+c+d == 7) cout << a '+' b '+' c '+' d << endl;
^~~
5 warnings and 7 errors generated.
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ ./a
1222
q
Kosuke-no-MacBook-Pro:Atcorder Kosuke$
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ g++ -o a abc079c.cpp
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ ./a
1222
a+b+c+d=7
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ ./a
2222
Kosuke-no-MacBook-Pro:Atcorder Kosuke$ emacs
#include<iostream>
using namespace std;
typedef long long ll;
int main(){
string s;
cin >>s;
int N=s.size();
ll ans=0;
for(int i=0;i<N;i++){
ll num=s[0] - '0';
for(int j=0;j<n-1;j++){
if(i&(1<<j)){
ans += num;
num=0;
}
num = num * 10 +s[j+1] - '0';
}
ans += num;
}
cout << ans << ensdl;
}
|
a.cc:1:1: error: 'Last' does not name a type
1 | Last login: Tue Sep 11 13:04:54 on ttys000
| ^~~~
a.cc:7:29: error: expected unqualified-id before '^' token
7 | ^
| ^
a.cc:9:1: error: 'abc079c' does not name a type
9 | abc079c.cpp:11:33: error: expected ';' after expression
| ^~~~~~~
a.cc:11:33: error: expected unqualified-id before '^' token
11 | ^
| ^
a.cc:13:1: error: 'abc079c' does not name a type
13 | abc079c.cpp:11:35: error: expected ';' after expression
| ^~~~~~~
a.cc:15:35: error: expected unqualified-id before '^' token
15 | ^
| ^
a.cc:17:1: error: 'abc079c' does not name a type
17 | abc079c.cpp:11:39: error: expected ';' after expression
| ^~~~~~~
a.cc:19:39: error: expected unqualified-id before '^' token
19 | ^
| ^
a.cc:21:1: error: 'abc079c' does not name a type
21 | abc079c.cpp:11:41: error: expected ';' after expression
| ^~~~~~~
a.cc:23:41: error: expected unqualified-id before '^' token
23 | ^
| ^
a.cc:25:1: error: 'abc079c' does not name a type
25 | abc079c.cpp:11:45: error: expected ';' after expression
| ^~~~~~~
a.cc:27:45: error: expected unqualified-id before '^' token
27 | ^
| ^
a.cc:29:1: error: 'abc079c' does not name a type
29 | abc079c.cpp:11:51: error: reference to overloaded function could not be
| ^~~~~~~
a.cc:30:17: error: 'did' does not name a type
30 | resolved; did you mean to call it?
| ^~~
a.cc:32:51: error: expected unqualified-id before '^' token
32 | ^~~~
| ^
a.cc:39:30: error: expected unqualified-id before '^' token
39 | ^~~
| ^
a.cc:42:34: error: expected unqualified-id before '^' token
42 | ^
| ^
a.cc:45:36: error: expected unqualified-id before '^' token
45 | ^~~
| ^
a.cc:48:40: error: expected unqualified-id before '^' token
48 | ^
| ^
a.cc:51:42: error: expected unqualified-id before '^' token
51 | ^~~
| ^
a.cc:56:29: error: expected unqualified-id before '^' token
56 | ^
| ^
a.cc:58:1: error: 'abc079c' does not name a type
58 | abc079c.cpp:11:33: error: expected ';' after expression
| ^~~~~~~
a.cc:60:33: error: expected unqualified-id before '^' token
60 | ^
| ^
a.cc:62:1: error: 'abc079c' does not name a type
62 | abc079c.cpp:11:35: error: expected ';' after expression
| ^~~~~~~
a.cc:64:35: error: expected unqualified-id before '^' token
64 | ^
| ^
a.cc:66:1: error: 'abc079c' does not name a type
66 | abc079c.cpp:11:39: error: expected ';' after expression
| ^~~~~~~
a.cc:68:39: error: expected unqualified-id before '^' token
68 | ^
| ^
a.cc:70:1: error: 'abc079c' does not name a type
70 | abc079c.cpp:11:41: error: expected ';' after expression
| ^~~~~~~
a.cc:72:41: error: expected unqualified-id before '^' token
72 | ^
| ^
a.cc:74:1: error: 'abc079c' does not name a type
74 | abc079c.cpp:11:45: error: expected ';' after expression
| ^~~~~~~
a.cc:76:45: error: expected unqualified-id before '^' token
76 | ^
| ^
a.cc:78:1: error: 'abc079c' does not name a type
78 | abc079c.cpp:11:51: error: reference to overloaded function could not be
| ^~~~~~~
a.cc:79:17: error: 'did' does not name a type
79 | resolved; did you mean to call it?
| ^~~
a.cc:81:51: error: expected unqualified-id before '^' token
81 | ^~~~
| ^
a.cc:88:30: error: expected unqualified-id before '^' token
88 | ^~~
| ^
a.cc:91:34: error: expected unqualified-id before '^' token
91 | ^
| ^
a.cc:94:36: error: expected unqualified-id before '^' token
94 | ^~~
| ^
a.cc:97:40: error: expected unqualified-id before '^' token
97 | ^
| ^
a.cc:100:42: error: expected unqualified-id before '^' token
100 | ^~~
| ^
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:115:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~
|
s404878805
|
p04001
|
Java
|
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
String ans="";
long sum = 0;
Scanner sc = new Scanner(System.in);
char[] charArray = sc.next().toCharArray();
for(int bit = 0; bit < Math.pow(2, charArray.length -1) ; bit++) {
ans = String.valueOf(charArray[0]);
for(int i = 0 ; i < charArray.length - 1 ;i++) {
if((1 & (bit >> i)) == 1) {
ans += ",";
}
ans += String.valueOf(charArray[i+1]);
}
String num[] = ans.split(",");
for(int i = 0; i < num.length;i++) {
sum += Long.valueOf(num[i]);
}
}
System.out.println(sum);
sc.close();
}
|
Main.java:27: error: reached end of file while parsing
}
^
1 error
|
s767180476
|
p04001
|
C++
|
if((bit & (1 << i))){
sum += stoi( part );
cout << part << endl;
part = "";
|
a.cc:1:1: error: expected unqualified-id before 'if'
1 | if((bit & (1 << i))){
| ^~
|
s725524617
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
char s[12345];
int main(int argc, char const *argv[])
{
scanf("%c",&s);
int n = strlen(s);
long long ret = 0;
for (int i = 0; i < 1<<(n-1); ++i)
{
long long now = 0;
long long sum = 0;
for (int j = 0; j < n; ++j)
{
now=now*10 long long;
now+=s[i]-'0';
if (i<n-1&&(s>>i&1))
{
sum+=now;
now =0;
}
}
sum+=now;
ret+=sum;
}
printf("%lld\n",ret);
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:15:17: error: expected ';' before 'long'
15 | now=now*10 long long;
| ^~~~~
| ;
a.cc:17:20: error: invalid operands of types 'char [12345]' and 'int' to binary 'operator>>'
17 | if (i<n-1&&(s>>i&1))
| ~^~~
| | |
| | int
| char [12345]
|
s148796371
|
p04001
|
C++
|
#include <bits/stdc++.h>
using namespace std;
char s[12345];
int main(int argc, char const *argv[])
{
scanf("%s",&s);
int n = strlen(s);
long long ret = 0;
for (int i = 0; i < 1<<(n-1); ++i)
{
long long now = 0;
long long sum = 0;
for (int j = 0; j < n; ++j)
{
now=now*10 long long
now+=s[i]-'0';
if (i<n-1&&(s>>i&1))
{
sum+=now;
now =0;
}
}
sum+=now;
ret+=sum;
}
printf("%lld\n",ret);
return 0;
}
|
a.cc: In function 'int main(int, const char**)':
a.cc:15:17: error: expected ';' before 'long'
15 | now=now*10 long long
| ^~~~~
| ;
a.cc:17:20: error: invalid operands of types 'char [12345]' and 'int' to binary 'operator>>'
17 | if (i<n-1&&(s>>i&1))
| ~^~~
| | |
| | int
| char [12345]
|
s146888129
|
p04001
|
C++
|
#include <stdlib.h>
using namespace std;
string S;
string S_0 = "0";
int len;
string cut(string str){
S_0 = str[0];
string tmp = str.substr(1);
return tmp;
}
int main(){
int i=0;
cin >> S;
len = S.size();
long long sum = stoll(S.c_str());
string tmp = S;
string tmp3 = S;
for(int i=1; i<len; i++){
sum += stoll(tmp.substr(0,i).c_str());
string tmp2 = tmp.substr(i);
sum += stoll(tmp2.c_str());
int count = 0;
while(tmp2.size()!=1){
sum += stoll(tmp.substr(0,i).c_str());
sum += count* stoll(S_0.substr());
tmp2 = cut(tmp2);
sum += stoll(S_0.substr());
sum += stoll(tmp2.substr());
count++;
}
}
cout << sum << endl;
}
|
a.cc:4:1: error: 'string' does not name a type
4 | string S;
| ^~~~~~
a.cc:5:1: error: 'string' does not name a type
5 | string S_0 = "0";
| ^~~~~~
a.cc:8:1: error: 'string' does not name a type
8 | string cut(string str){
| ^~~~~~
a.cc: In function 'int main()':
a.cc:16:9: error: 'cin' was not declared in this scope
16 | cin >> S;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include <stdlib.h>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:16:16: error: 'S' was not declared in this scope
16 | cin >> S;
| ^
a.cc:18:25: error: 'stoll' was not declared in this scope
18 | long long sum = stoll(S.c_str());
| ^~~~~
a.cc:2:1: note: 'std::stoll' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
1 | #include <stdlib.h>
+++ |+#include <string>
2 | using namespace std;
a.cc:19:9: error: 'string' was not declared in this scope
19 | string tmp = S;
| ^~~~~~
a.cc:19:9: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:20:15: error: expected ';' before 'tmp3'
20 | string tmp3 = S;
| ^~~~~
| ;
a.cc:22:30: error: 'tmp' was not declared in this scope
22 | sum += stoll(tmp.substr(0,i).c_str());
| ^~~
a.cc:23:23: error: expected ';' before 'tmp2'
23 | string tmp2 = tmp.substr(i);
| ^~~~~
| ;
a.cc:24:30: error: 'tmp2' was not declared in this scope
24 | sum += stoll(tmp2.c_str());
| ^~~~
a.cc:28:45: error: 'S_0' was not declared in this scope
28 | sum += count* stoll(S_0.substr());
| ^~~
a.cc:29:32: error: 'cut' was not declared in this scope; did you mean 'count'?
29 | tmp2 = cut(tmp2);
| ^~~
| count
a.cc:35:9: error: 'cout' was not declared in this scope
35 | cout << sum << endl;
| ^~~~
a.cc:35:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:35:24: error: 'endl' was not declared in this scope
35 | cout << sum << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include <stdlib.h>
+++ |+#include <ostream>
2 | using namespace std;
|
s232247341
|
p04001
|
C++
|
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 1000000000
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
if(x==0)
return "0";
string ret="";
while(x){
ret=ret+(char)(x%10+'0');
x/=10;
}
reverse(ret.begin(),ret.end());
return ret;
}
string add(string a,string b){
if(a=="")
a="0";
if(b=="")
b="0";
if(a.length()<b.length())
swap(a,b);
while(b.length()<a.length()){
b='0'+b;
}
for(int i=0;i<a.length();i++){
a[i]=a[i]+(b[i]-'0');
}
bool big=false;
for(int i=a.length()-1;i>=0;i--){
if(big){
a[i]++;
}
big=false;
if(a[i]>'9'){
a[i]=a[i]-10;
big=true;
}
}
if(big)
a='1'+a;
return a;
}
string mul(string a,string b){
vector<int> va,vb;
if(a=="0" || b=="0")
return "0";
string ans;
for(int i=0;i<a.length();i++){
va.push_back(a[i]-'0');
}
for(int i=0;i<b.length();i++){
vb.push_back(b[i]-'0');
}
reverse(va.begin(),va.end());
reverse(vb.begin(),vb.end());
vector<int> res;
res.clear();
res.resize(1005);
for(int i=0;i<a.length();i++){
for(int j=0;j<b.length();j++){
res[i+j]+=(va[i]*vb[j]);
}
}
for(int i=0;i<1005;i++){
if(res[i]>9){
res[i+1]+=(res[i]/10);
res[i]%=10;
}
}
for(int i=0;i<1005;i++){
ans+=(res[i]+'0');
}
reverse(ans.begin(),ans.end());
int k=0;
while(ans[k]=='0'){
k++;
}
ans=ans.substr(k);
return ans;
}
bool is_prime(int n){
if(n<2)
return false;
for(int i=2;i*i<=n;i++)
if(n%i==0)
return false;
return true;
}
#define MAX 1000005
int N, M, a, b, c, pt, mx=-1, q[MAX], ptr[MAX], step[MAX];
vector<pi> lian[MAX];
vector<int> all[MAX], newlian[MAX];
int vis[MAX];
int main(){
//freopen("input.in","r",stdin);
//freopen("output.out","w",stdout);
scanf("%d %d", &N, &M);
pt=N;
while(M--)
{
scanf("%d %d %d", &a, &b, &c);
a--, b--;
all[c].push_back(a);
all[c].push_back(b);
lian[a].push_back(mp(c, b));
lian[b].push_back(mp(c, a));
mx=max(mx, c);
}
for(int i=0; i<N; i++)
{
sort(lian[i].begin(), lian[i].end());
ptr[i]=0;
vis[i]=-1;
}
for(int clr=0; clr<=mx; clr++)
{
if(!all[clr].size())
continue;
for(int it=0; it<all[clr].size(); it++)
{
int v=all[clr][it];
if(vis[v]==clr)
continue;
int l=0, r=1;
q[0]=v;
while(l<r)
{
int t=q[l];
while(ptr[t]<lian[t].size())
{
c=lian[t][ptr[t]].first;
if(c!=clr)
break;
int u=lian[t][ptr[t]].second;
if(vis[u]!=clr)
{
vis[u]=clr;
q[r++]=u;
}
ptr[t]++;
}
l++;
}
for(int i=0; i<r; i++)
{
newlian[pt].push_back(q[i]);
newlian[q[i]].push_back(pt);
}
pt++;
}
}
for(int i=0; i<pt; i++)
step[i]=-2;
int l=0, r=1;
q[0]=0;
step[0]=0;
while(l<r)
{
for(int j=0; j<newlian[q[l]].size(); j++)
{
int u=newlian[q[l]][j];
if(step[u]==-2)
{
step[u]=step[q[l]]+1;
q[r++]=u;
}
}
l++;
}
printf("%d", step[N-1]/2);
//system("pause");
return 0;
}
|
a.cc:159:9: warning: "MAX" redefined
159 | #define MAX 1000005
| ^~~
a.cc:66:9: note: this is the location of the previous definition
66 | #define MAX 1000000000000000000
| ^~~
a.cc:161:8: error: 'pi' was not declared in this scope; did you mean 'pt'?
161 | vector<pi> lian[MAX];
| ^~
| pt
a.cc:161:10: error: template argument 1 is invalid
161 | vector<pi> lian[MAX];
| ^
a.cc:161:10: error: template argument 2 is invalid
a.cc: In function 'int main()':
a.cc:175:25: error: request for member 'push_back' in 'lian[a]', which is of non-class type 'int'
175 | lian[a].push_back(mp(c, b));
| ^~~~~~~~~
a.cc:176:25: error: request for member 'push_back' in 'lian[b]', which is of non-class type 'int'
176 | lian[b].push_back(mp(c, a));
| ^~~~~~~~~
a.cc:181:30: error: request for member 'begin' in 'lian[i]', which is of non-class type 'int'
181 | sort(lian[i].begin(), lian[i].end());
| ^~~~~
a.cc:181:47: error: request for member 'end' in 'lian[i]', which is of non-class type 'int'
181 | sort(lian[i].begin(), lian[i].end());
| ^~~
a.cc:199:54: error: request for member 'size' in 'lian[t]', which is of non-class type 'int'
199 | while(ptr[t]<lian[t].size())
| ^~~~
a.cc:201:50: error: invalid types 'int[int]' for array subscript
201 | c=lian[t][ptr[t]].first;
| ^
a.cc:204:54: error: invalid types 'int[int]' for array subscript
204 | int u=lian[t][ptr[t]].second;
| ^
|
s985469491
|
p04001
|
C++
|
#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <unordered_map>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;j<N;j++)
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define For(I,N) for(int I=0;I<N;I++)
#define cinone(N) int N;cin>>N;
#define scanfone(N) int N;cin>>N;
#define cinng(N,M) int N[M];for(int yiuytvnm=0;yiuytvnm<M;yiuytvnm++) cin>>N[yiuytvnm];
#define scanfng(N,M) int N[M];for(int qrwuoiq=0;qrwuoiq<M;qrwuoiq++) scanf("%d",&N[qrwuoiq]);
#define over(A) {cout<<A<<endl;exit(0);}
typedef unsigned long long ull;
const int inf=1039704182;
using namespace std;
int n,m;
vector <pii> vec[100005];
set <pair<pii,int> > squ;
unordered_map <pii,int> dist;
int main()
{
// freopen("input.txt","r",stdin);
cin>>n>>m;
int x,y,z;
for(int i=0;i<m;i++)
{
scanf("%d%d%d",&x,&y,&z);
x--;
y--;
vec[x].push_back(mp(y,z));
vec[y].push_back(mp(x,z));
}
squ.insert(mp(mp(0,0),0));//distance, position and company.
while(squ.size())
{
int x=squ.begin()->first.second;
int d=squ.begin()->first.first;
int boss=squ.begin()->second;
squ.erase(mp(mp(d,x),boss));
int c;
if(boss==0)
{
for(int i=0;i<vec[x].size();i++)
{
c=vec[x][i].second;
if(dist.find(mp(vec[x][i].first,c))==dist.end() || dist[mp(vec[x][i].first,c)]>d+1)
{
dist[mp(vec[x][i].first,c)]=d+1;
squ.insert(mp(mp(d+1,vec[x][i].first),c));
}
}
}
else
{
if(dist.find(mp(x,0))==dist.end() || dist[mp(x,0)]>d)
{
dist[mp(x,0)]=d;
squ.insert(mp(mp(d,x),0));
}
for(int i=0;i<vec[x].size();i++)
{
if(vec[x][i].second!=boss) continue;
if(dist.find(mp(vec[x][i].first,boss))==dist.end() || dist[mp(vec[x][i].first,boss)]>d)
{
dist[mp(vec[x][i].first,boss)]=d;
squ.insert(mp(mp(d,vec[x][i].first),boss));
}
}
}
}
int res=inf;
for(int i=0;i<1000000;i++)
{
if(dist.find(mp(n-1,i))==dist.end()) continue;
res=min(res,dist[mp(n-1,i)]);
}
cout<<(res==inf?-1:res)<<endl;
return 0;
}
|
a.cc:33:25: error: use of deleted function 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]'
33 | unordered_map <pii,int> dist;
| ^~~~
In file included from /usr/include/c++/14/unordered_map:41,
from a.cc:13:
/usr/include/c++/14/bits/unordered_map.h:148:7: note: 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map() [with _Key = std::pair<int, int>; _Tp = int; _Hash = std::hash<std::pair<int, int> >; _Pred = std::equal_to<std::pair<int, int> >; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >]' is implicitly deleted because the default definition would be ill-formed:
148 | unordered_map() = default;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/unordered_map.h:148:7: error: use of deleted function 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/unordered_map.h:33:
/usr/include/c++/14/bits/hashtable.h:539:7: note: 'std::_Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _RehashPolicy, _Traits>::_Hashtable() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _Alloc = std::allocator<std::pair<const std::pair<int, int>, int> >; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]'
In file included from /usr/include/c++/14/bits/hashtable.h:35:
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: 'std::__detail::_Hashtable_base<_Key, _Value, _ExtractKey, _Equal, _Hash, _RangeHash, _Unused, _Traits>::_Hashtable_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Equal = std::equal_to<std::pair<int, int> >; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; _Traits = std::__detail::_Hashtable_traits<true, false, true>]' is implicitly deleted because the default definition would be ill-formed:
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]'
/usr/include/c++/14/bits/hashtable_policy.h: In instantiation of 'std::__detail::_Hashtable_ebo_helper<_Nm, _Tp, true>::_Hashtable_ebo_helper() [with int _Nm = 1; _Tp = std::hash<std::pair<int, int> >]':
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: required from here
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: error: use of deleted function 'std::hash<std::pair<int, int> >::hash()'
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
In file included from /usr/include/c++/14/string_view:50,
from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: no matching function for call to 'std::__hash_enum<std::pair<int, int>, false>::__hash_enum()'
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate: 'std::__hash_enum<_Tp, <anonymous> >::__hash_enum(std::__hash_enum<_Tp, <anonymous> >&&) [with _Tp = std::pair<int, int>; bool <anonymous> = false]'
83 | __hash_enum(__hash_enum&&);
| ^~~~~~~~~~~
/usr/include/c++/14/bits/functional_hash.h:83:7: note: candidate expects 1 argument, 0 provided
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1245:49: note: use '-fdiagnostics-all-candidates' to display considered candidates
1245 | _Hashtable_ebo_helper() noexcept(noexcept(_Tp())) : _Tp() { }
| ^~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: note: 'std::__detail::_Hash_code_base<_Key, _Value, _ExtractKey, _Hash, _RangeHash, _Unused, __cache_hash_code>::_Hash_code_base() [with _Key = std::pair<int, int>; _Value = std::pair<const std::pair<int, int>, int>; _ExtractKey = std::__detail::_Select1st; _Hash = std::hash<std::pair<int, int> >; _RangeHash = std::__detail::_Mod_range_hashing; _Unused = std::__detail::_Default_ranged_hash; bool __cache_hash_code = true]' is implicitly deleted because the default definition would be ill-formed:
1328 | _Hash_code_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1328:7: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: note: 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()' is implicitly deleted because the default definition would be ill-formed:
1242 | struct _Hashtable_ebo_helper<_Nm, _Tp, true>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1242:12: error: use of deleted function 'std::hash<std::pair<int, int> >::~hash()'
/usr/include/c++/14/bits/functional_hash.h:102:12: note: 'std::hash<std::pair<int, int> >::~hash()' is implicitly deleted because the default definition would be ill-formed:
102 | struct hash : __hash_enum<_Tp>
| ^~~~
/usr/include/c++/14/bits/functional_hash.h:102:12: error: 'std::__hash_enum<_Tp, <anonymous> >::~__hash_enum() [with _Tp = std::pair<int, int>; bool <anonymous> = false]' is private within this context
/usr/include/c++/14/bits/functional_hash.h:84:7: note: declared private here
84 | ~__hash_enum();
| ^
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
1731 | _Hashtable_base() = default;
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1731:7: error: use of deleted function 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()'
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: note: 'std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>::~_Hash_code_base()' is implicitly deleted because the default definition would be ill-formed:
1306 | struct _Hash_code_base
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/bits/hashtable_policy.h:1306:12: error: use of deleted function 'std::__detail::_Hashtable_ebo_helper<1, std::hash<std::pair<int, int> >, true>::~_Hashtable_ebo_helper()'
/usr/include/c++/14/bits/hashtable.h:539:7: note: use '-fdiagnostics-all-candidates' to display considered candidates
539 | _Hashtable() = default;
| ^~~~~~~~~~
/usr/include/c++/14/bits/hashtable.h:539:7: error: use of deleted function 'std::__detail::_Hashtable_base<std
|
s817122059
|
p04001
|
C++
|
/*
* @Author: SugarSBN
* @Date: 2018-07-14 19:06:53
* @Language: C++
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<string>
#include<queue>
#include<stack>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<cmath>
#include<sstream>
#include<fstream>
using namespace std;
const int MAXN=2e8+11;
const double pi=acos(-1);
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef double dbl;
#define For(a,b,c) for (int (a)=(b);(a)<(c);(a)++)
#define foreach(iter,V) for (__typeof((V.begin()) iter=(V).begin();iter!=(V).end();iter++)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
vector<pii> col[MAXN];
int col_kinds[MAXN],num_of_colkinds=0;
int fa[MAXN];
int getfa(int u){
return fa[u] == u ? u : fa[u] = getfa(fa[u]);
}
vi new_g[MAXN];
int right_point;
int n, m;
int a, b, c;
int main(){
// freopen("in.txt", "r", stdin);
scanf("%d%d", &n, &m);
right_point = n;
bool vis[MAXN]={0};
For(i,0,m){
scanf("%d%d%d", &a, &b, &c);
a--;
b--;
c--;
if (!vis[c]){
col_kinds[num_of_colkinds++] = c;
vis[c] = 1;
}
col[c].pb(mp(a, b));
}
For(i, 0, n) fa[i] = i;
For(i,0,num_of_colkinds){
For(j,0,col[col_kinds[i]].size()){
int fx = getfa(col[col_kinds[i]][j].fi);
int fy = getfa(col[col_kinds[i]][j].se);
fa[fx] = fy;
}
int ptr[MAXN]={0};
For(j,0,col[col_kinds[i]].size()){
if (!ptr[getfa(col[col_kinds[i]][j].fi)]){
new_g[col[col_kinds[i]][j].fi].pb(right_point);
new_g[right_point].pb(col[col_kinds[i]][j].fi);
ptr[getfa(col[col_kinds[i]][j].fi)] = right_point;
right_point++;
}else{
new_g[col[col_kinds[i]][j].fi].pb(ptr[getfa(col[col_kinds[i]][j].fi)]);
new_g[ptr[getfa(col[col_kinds[i]][j].fi)]].pb(col[col_kinds[i]][j].fi);
}
if (!ptr[getfa(col[col_kinds[i]][j].se)]){
new_g[col[col_kinds[i]][j].se].pb(right_point);
new_g[right_point].pb(col[col_kinds[i]][j].se);
ptr[getfa(col[col_kinds[i]][j].se)] = right_point;
right_point++;
}else{
new_g[col[col_kinds[i]][j].se].pb(ptr[getfa(col[col_kinds[i]][j].se)]);
new_g[ptr[getfa(col[col_kinds[i]][j].se)]].pb(col[col_kinds[i]][j].se);
}
}
}
int dis[MAXN];
For(i, 0, right_point) dis[i] = -2;
dis[0] = 0;
queue<int> Q;
Q.push(0);
while(!Q.empty()){
int v=Q.front();
Q.pop();
For(i,0,new_g[v].size()){
if(dis[new_g[v][i]]==-2){
Q.push(new_g[v][i]);
dis[new_g[v][i]] = dis[v] + 1;
}
}
}
printf("%d\n", dis[n - 1] / 2);
return 0;
}
|
/tmp/cc1NOf5t.o: in function `getfa(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `fa' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0x37): relocation truncated to fit: R_X86_64_PC32 against symbol `fa' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against symbol `fa' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `fa' defined in .bss section in /tmp/cc1NOf5t.o
/tmp/cc1NOf5t.o: in function `main':
a.cc:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0xb1): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `right_point' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `c' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/cc1NOf5t.o
a.cc:(.text+0xf7): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s340659035
|
p04001
|
C++
|
#pragma GCC optimize(2)
//Happy TLE and WA every day!
#include<bits/stdc++.h>
#define mp make_pair
#define rep(i,n) for(int i = 0; i < n; i++)
#define BINF 0x7fffffff
#define INF 0x3f3f3f3f
#define LINF 3223372036854775807
#define END(s) {cout<<s; return 0;}
#define CON(s) {cout<<s; continue;}
#define BRE(s) {cout<<s; break;}
#define pb push_back
#define int long long
#define All(a) a.begin(), a.end() //with A in CAPITAL!!!
#define sz(a) (int)a.size()
#define F first
#define S second
//#define usingFiles
using namespace std;
const int rp = 666666;
const bool debug = 1;
string s;
int cur = 0;
int sum = 0;
int n;
inline int stoi(string ss){
if(ss.size() == 1) return ss[0] - '0';
return (ss[ss.size() - 1] - '0') + stoi(ss.substr(0, ss.size() - 1)) * 10;
}
void dfs(int now, int pre){
if(now == n){
sum += (cur + stoi(s.substr(pre, n - pre)));
return ;
}
cur += stoi(s.substr(pre, now - pre));
dfs(now + 1, now);
cur -= stoi(s.substr(pre, now - pre));
dfs(now + 1, pre);
}
signed main(){
ios::sync_with_stdio(false);
#ifdef usingFiles
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
cin >> s;
n = s.size();
dfs(1, 0);
cout << sum << endl;
return 0;
}
|
a.cc: In function 'long long int stoi(std::string)':
a.cc:31:48: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
31 | return (ss[ss.size() - 1] - '0') + stoi(ss.substr(0, ss.size() - 1)) * 10;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:12: note: candidate: 'long long int stoi(std::string)'
29 | inline int stoi(string ss){
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/c++/14/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
from a.cc:3:
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc: In function 'void dfs(long long int, long long int)':
a.cc:36:35: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
36 | sum += (cur + stoi(s.substr(pre, n - pre)));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:12: note: candidate: 'long long int stoi(std::string)'
29 | inline int stoi(string ss){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:39:20: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
39 | cur += stoi(s.substr(pre, now - pre));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:12: note: candidate: 'long long int stoi(std::string)'
29 | inline int stoi(string ss){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
a.cc:41:20: error: call of overloaded 'stoi(std::__cxx11::basic_string<char>)' is ambiguous
41 | cur -= stoi(s.substr(pre, now - pre));
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:29:12: note: candidate: 'long long int stoi(std::string)'
29 | inline int stoi(string ss){
| ^~~~
/usr/include/c++/14/bits/basic_string.h:4164:3: note: candidate: 'int std::__cxx11::stoi(const std::string&, std::size_t*, int)'
4164 | stoi(const string& __str, size_t* __idx = 0, int __base = 10)
| ^~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.