submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s552961679 | p00168 | C++ | #include <iostream>
using namespace std;
long long dp[31];
int main(){
dp[0]=0;
dp[1]=1;
dp[2]=2;
dp[3]=4;
int i=4;
while(i<31){
dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
//cout << i << endl;
i++;
}
for(;;){
int n;
cin >> n;
if(n==0)return 0;
if(dp[n]%3650==0)
cout << (dp[n]/3650);
else
cout << (dp[n]/3650)+1;
} | a.cc: In function 'int main()':
a.cc:25:2: error: expected '}' at end of input
25 | }
| ^
a.cc:5:11: note: to match this '{'
5 | int main(){
| ^
|
s275517383 | p00168 | C++ | #include<iostream>
int dp[30];//段数ー1
int main(){
int n;
while(std::cin>>n,n){
memset(dp,0,sizeof(dp));
dp[0]=1;
dp[1]=2;
dp[2]=4;
for(int i=3;i<n;i++){
dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
}
if(dp[n-1]%365==0)std::cout<<dp[n-1]/3650<<std::endl;
else std::cout<<dp[n-1]/3650+1<<std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:17: error: 'memset' was not declared in this scope
8 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 |
|
s236756062 | p00168 | C++ | #include<iostream>
int dp[30];//段数ー1
int main(){
int n;
while(std::cin>>n,n){
std::memset(dp,0,sizeof(dp));
dp[0]=1;
dp[1]=2;
dp[2]=4;
for(int i=3;i<n;i++){
dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
}
if(dp[n-1]%365==0)std::cout<<dp[n-1]/3650<<std::endl;
else std::cout<<dp[n-1]/3650+1<<std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:22: error: 'memset' is not a member of 'std'; did you mean 'wmemset'?
8 | std::memset(dp,0,sizeof(dp));
| ^~~~~~
| wmemset
|
s376888385 | p00168 | C++ | #include<iostream>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;
void solve(){
int n;
long long a[30] = {1,2,4};
loop(i,3,30)a[i] = a[i-1] + a[i-2] + a[i-3];
while(cin>>n,n)
cout<<i+a[n-1]/3650<<endl;
}
int main(void){
solve();
return 0;
} | a.cc: In function 'void solve()':
a.cc:11:11: error: 'i' was not declared in this scope
11 | cout<<i+a[n-1]/3650<<endl;
| ^
|
s446662511 | p00168 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
const int MAX= 10000100;
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}
int main(void){
int n;
int m[31] = {1,1,2};
loop(i,3,31)
m[i] = m[i-1] + m[i-2] + m[i-3];
while(cin>>n,n)
cout<<m[i]/3650 + 1 <<endl;
} | a.cc: In function 'int main()':
a.cc:32:13: error: 'i' was not declared in this scope
32 | cout<<m[i]/3650 + 1 <<endl;
| ^
|
s545982095 | p00168 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int solve(int n);
int dp[100];
int main(){
int n;
while(cin >> n , n){
memset(dp,0,n+2);
int ans = solve(n);
cout << ans/365/10+1 << endl;
}
}
int solve(int n){
if(n == 0) return 1;
if(dp[n] != 0) return dp[n];
int cou=0;
for(int i=1;i<=3;i++){
if(n-i >= 0) cou += solve(n-i);
}
return dp[n] = cou;
} | a.cc: In function 'int main()':
a.cc:11:17: error: 'memset' was not declared in this scope
11 | memset(dp,0,n+2);
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<algorithm>
+++ |+#include <cstring>
3 | using namespace std;
|
s108639663 | p00168 | C++ | #include<iostream>
using namespace std;
int main(){
int ans[31]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,6,10,19,34,62,113,207,381,701,1288,2369,4357,8014,14740}
while(1){
cin>>ans[0];
if(!ans[0])
return 0;
cout<<ans[ans[0]];
}
} | a.cc: In function 'int main()':
a.cc:5:3: error: expected ',' or ';' before 'while'
5 | while(1){
| ^~~~~
|
s468984210 | p00168 | C++ | #include<iostream>
using namespace std;
int n;
int mamo[31], ans[31];
int main(){
while(cin>>n){
if(!n)
return 0;
memo[0]=1;
memo[1]=1;
memo[2]=2;
for(int i=3;i<=n;i++){
if(!memo[i]){
memo[i]=memo[i-1]+memo[i-2]+memo[i-3];
}
}
if(memo[n]%3650)
ans[n]+=1;
ans[n]+=memo[n]/3650;
cout<<ans[n]<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:5: error: 'memo' was not declared in this scope; did you mean 'mamo'?
9 | memo[0]=1;
| ^~~~
| mamo
|
s620743755 | p00168 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
using namespace std;
int main(){
????????????int n;
????????????while(cin >> n, n){
int dp[100] = {0};
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
repn(i, 4, 30) dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
cout << (dp[n] / 10 / 365) + (dp[n]%3650==0 ? 0 : 1) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:1: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:2: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:3: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:4: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:5: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:6: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:7: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:8: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:9: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:10: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:11: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:12: error: expected primary-expression before '?' token
16 | ????????????int n;
| ^
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:16:13: error: expected ':' before 'int'
16 | ????????????int n;
| ^~~
| :
a.cc:16:13: error: expected primary-expression before 'int'
16 | ????????????int n;
| ^~~
a.cc:17:1: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:2: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:3: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:4: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:5: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:6: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:7: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:8: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:9: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:10: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:11: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:12: error: expected primary-expression before '?' token
17 | ????????????while(cin >> n, n){
| ^
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
a.cc:17:13: error: expected ':' before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
| :
a.cc:17:13: error: expected primary-expression before 'while'
17 | ????????????while(cin >> n, n){
| ^~~~~
|
s221283888 | p00168 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
using namespace std;
int main(){
int n;
while(cin >> n, n){
????????????int dp[100] = {0};
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
repn(i, 4, 30) dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
cout << (dp[n] / 10 / 365) + (dp[n]%3650==0 ? 0 : 1) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:1: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:2: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:3: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:4: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:5: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:6: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:7: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:8: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:9: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:10: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:11: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:12: error: expected primary-expression before '?' token
21 | ????????????int dp[100] = {0};
| ^
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:21:13: error: expected ':' before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
| :
a.cc:21:13: error: expected primary-expression before 'int'
21 | ????????????int dp[100] = {0};
| ^~~
a.cc:22:9: error: 'dp' was not declared in this scope
22 | dp[1] = 1;
| ^~
|
s175733348 | p00168 | C++ | include<iostream>
using namespace::std;
int fib(int n) {
int x[100];
x[0] = 0;
x[1] = 1;
x[2] = 2;
x[3] = 4;
for (int i = 4; i <= n; i++) {
x[i] = x[i - 3] + x[i - 2] + x[i - 1];
}
return x[n];
}
int main() {
cin >> n;
int ans;
int ama;
ans = n / 3;
ans = ans * 4;
if (n % 3 == 1) {
ans +=
}
else if (n % 3 == 2) {
}*/
int a[100];
int i= 0;
while (true) {
cin >>a[i];
if (a[i] == 0)
break;
i++;
}
for (int j = 0; j < i; j++) {
if (a[j] != 0) {
cout << fib(a[j])/10/ 365 + 1 << endl;
}
else {
cout <<0<<endl;
}
}
return 0;
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:24:9: error: 'cin' was not declared in this scope
24 | cin >> n;
| ^~~
a.cc:24:16: error: 'n' was not declared in this scope
24 | cin >> n;
| ^
a.cc:33:9: error: expected primary-expression before '}' token
33 | }
| ^
a.cc:36:11: error: expected primary-expression before '/' token
36 | }*/
| ^
a.cc:37:9: error: expected primary-expression before 'int'
37 | int a[100];
| ^~~
a.cc:41:23: error: 'a' was not declared in this scope
41 | cin >>a[i];
| ^
a.cc:48:21: error: 'a' was not declared in this scope
48 | if (a[j] != 0) {
| ^
a.cc:49:25: error: 'cout' was not declared in this scope
49 | cout << fib(a[j])/10/ 365 + 1 << endl;
| ^~~~
a.cc:49:58: error: 'endl' was not declared in this scope
49 | cout << fib(a[j])/10/ 365 + 1 << endl;
| ^~~~
a.cc:52:25: error: 'cout' was not declared in this scope
52 | cout <<0<<endl;
| ^~~~
a.cc:52:35: error: 'endl' was not declared in this scope
52 | cout <<0<<endl;
| ^~~~
|
s866339118 | p00168 | C++ | #include <iostream>
using namespace std;
int main() {
int a[30];
a[0] = 1;
a[1] = 1;
a[2] = 2;
for ( int i = 3; i <= 30; i++ )
a[i] = a[i - 1] + a[i - 2] + a[i - 3];
while ( int n; cin >> n )
cout << a[n] << endl;
} | a.cc: In function 'int main()':
a.cc:11:22: error: expected initializer before ';' token
11 | while ( int n; cin >> n )
| ^
a.cc:11:22: error: expected ')' before ';' token
11 | while ( int n; cin >> n )
| ~ ^
| )
a.cc:11:31: error: 'n' was not declared in this scope
11 | while ( int n; cin >> n )
| ^
|
s965499362 | p00168 | C++ | #include <iostream>
using namespace std;
int main() {
int a[30];
a[0] = 1;
a[1] = 1;
a[2] = 2;
for ( int i = 3; i <= 30; i++ )
a[i] = a[i - 1] + a[i - 2] + a[i - 3];
while ( cin >> n ) {
int n;
cin >> n;
if ( n == 0 ) break;
cout << a[n] << endl;
}
} | a.cc: In function 'int main()':
a.cc:11:24: error: 'n' was not declared in this scope
11 | while ( cin >> n ) {
| ^
|
s446389794 | p00168 | C++ |
#include <algorithm>
#include <iostream>
using namespace std;
int A[128], n, a;
int main() {
while(cin >> n && n >0){
A[0] = 0;
A[1] = 1;
A[2] = 2;
for (int i=3; i<=n+10; ++i) {
A[i] = A[i-1]+A[i-2]+A[i-3];
}
a = (A[n]+9)/10
a = (a+364)/365;
cout << a <<endl;
}
} | a.cc: In function 'int main()':
a.cc:15:32: error: expected ';' before 'a'
15 | a = (A[n]+9)/10
| ^
| ;
16 | a = (a+364)/365;
| ~
|
s878851404 | p00168 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
int A[128], n, a;
int main() {
while(cin >> n && n >0){
A[0] = 0;
A[1] = 1;
A[2] = 2;
for (int i=3; i<=n+10; ++i) {
A[i] = A[i-1]+A[i-2]+A[i-3];
}
a = int((A[n]+9)/10);
a = int(a+364)/365);
cout << a <<endl;
}
} | a.cc: In function 'int main()':
a.cc:15:35: error: expected ';' before ')' token
15 | a = int(a+364)/365);
| ^
| ;
|
s328918803 | p00168 | C++ |
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;
int A[128], n;
int main() {
while(cin >> n && n >0){
A[0] = 0;
A[1] = 1;
A[2] = 2;
for (int i=3; i<=n+10; ++i) {
A[i] = A[i-1]+A[i-2]+A[i-3];
}
double a = floor((A[n]+9)/10);
double a = floor((a+364)/365);
cout << a <<endl;
}
} | a.cc: In function 'int main()':
a.cc:18:24: error: redeclaration of 'double a'
18 | double a = floor((a+364)/365);
| ^
a.cc:17:24: note: 'double a' previously declared here
17 | double a = floor((A[n]+9)/10);
| ^
|
s459006285 | p00168 | C++ | #include <stdio.h> #include <iostream> #include <cstdio> using namespace std; int x, c=0; void dfs(int pos) { if (pos == 1) { c++; return; }else if (pos == 2) { c = c + 2; return; } else if (pos == 3) { c = c + 4; return; } else { dfs(pos - 1); dfs(pos - 2); dfs(pos - 3); } } int main() { while (1) { int days = 0, years = 0; c = 0; cin >> x; if (x == 0) { break; } dfs(x); days = c / 10; if (c % 10 != 0) { days++; } years = days / 365; if (days % 365 != 0) { years++; } cout << years << endl; } } | a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <stdio.h> #include <iostream> #include <cstdio> using namespace std; int x, c=0; void dfs(int pos) { if (pos == 1) { c++; return; }else if (pos == 2) { c = c + 2; return; } else if (pos == 3) { c = c + 4; return; } else { dfs(pos - 1); dfs(pos - 2); dfs(pos - 3); } } int main() { while (1) { int days = 0, years = 0; c = 0; cin >> x; if (x == 0) { break; } dfs(x); days = c / 10; if (c % 10 != 0) { days++; } years = days / 365; if (days % 365 != 0) { years++; } cout << years << endl; } }
| ^
/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
|
s303344450 | p00168 | C++ | #include <stdio.h> #include <iostream> #include <cstdio> using namespace std; int x, c=0; void dfs(int pos) { if (pos == 1) { c++; return; }else if (pos == 2) { c = c + 2; return; } else if (pos == 3) { c = c + 4; return; } else { dfs(pos - 1); dfs(pos - 2); dfs(pos - 3); } } int main() { while (1) { int days = 0, years = 0; c = 0; cin >> x; if (x == 0) { break; } dfs(x); days = c / 10; if (c % 10 != 0) { days++; } years = days / 365; if (days % 365 != 0) { years++; } cout << years << endl; } } | a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <stdio.h> #include <iostream> #include <cstdio> using namespace std; int x, c=0; void dfs(int pos) { if (pos == 1) { c++; return; }else if (pos == 2) { c = c + 2; return; } else if (pos == 3) { c = c + 4; return; } else { dfs(pos - 1); dfs(pos - 2); dfs(pos - 3); } } int main() { while (1) { int days = 0, years = 0; c = 0; cin >> x; if (x == 0) { break; } dfs(x); days = c / 10; if (c % 10 != 0) { days++; } years = days / 365; if (days % 365 != 0) { years++; } cout << years << endl; } }
| ^
/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
|
s616118965 | p00168 | C++ | #include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int memo[300];
int dp(int num);
int main(void){
while(1){
int n;
cin >> n;
if(n == 0) break;
memset(memo, -1, sizeof(memo));
cout << (int)ceil(dp(n) / 3650.0) << endl;
//cout << dp(n) << endl;
}
return 0;
}
int dp(int num){
memo[0] = memo[1] = 1;
memo[2] = 2;
for(int i=3; i<=num; i++){
memo[i] = memo[i-1] + memo[i-2] + memo[i-3];
}
return memo[num];
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <iostream>
+++ |+#include <cstring>
4 | using namespace std;
|
s488661459 | p00168 | C++ | #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
using namespace std;
int memo[300];
int dp(int num);
int main(void){
while(1){
int n;
cin >> n;
if(n == 0) break;
memset(memo, -1, sizeof(memo));
cout << (int)ceil(dp(n) / 3650.0) << endl;
//cout << dp(n) << endl;
}
return 0;
}
int dp(int num){
memo[0] = memo[1] = 1;
memo[2] = 2;
for(int i=3; i<=num; i++){
memo[i] = memo[i-1] + memo[i-2] + memo[i-3];
}
return memo[num];
} | a.cc: In function 'int main()':
a.cc:16:17: error: 'memset' was not declared in this scope
16 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include <iostream>
+++ |+#include <cstring>
5 | using namespace std;
|
s713298698 | p00168 | C++ | #include <cstdio>
#include <cmath>
#include <iostream>
using namespace std;
int memo[300];
int dp(int num);
int main(void){
while(1){
int n;
cin >> n;
if(n == 0) break;
memset(memo, -1, sizeof(memo));
cout << (int)ceil(dp(n) / 3650.0) << endl;
//cout << dp(n) << endl;
}
return 0;
}
int dp(int num){
if(num < 0) return 0;
if(memo[num] != -1) return memo[num];
if(num <= 1) return memo[num] = 1;
return memo[num] = dp(num-1) + dp(num-2) + dp(num-3);
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(memo, -1, sizeof(memo));
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include <iostream>
+++ |+#include <cstring>
4 | using namespace std;
|
s245454436 | p00168 | C++ | #include <iostream>
#define INF_LL 9000000000000000000
#define INF 2000000000
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
class Union_find{
private:
vector<int> par;
vector<int> rank;
int n;
public:
Union_find(int a){
n = a;
for(int i = 0;i < n;i++){
par.push_back(i);
rank.push_back(0);
}
}
int find(int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par[x]);
}
}
void unite(int x, int y){
x = find(x);
y = find(y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
bool same(int x, int y){
return find(x) == find(y);
}
};
int main(void){
int n;
int a[33];
cin >> n;
a[0] = a[1] = 0;
a[2] = 1;
for(int i = 3;i < n+3;i++){
a[i] = a[i-3] + a[i-1] + a[i-2];
}
int res = a[n+2]/10/365;
if(a[n+2]% 3650 != 0)
res ++;
cout << res << endl;
return 0;
} | a.cc:17:9: error: 'vector' does not name a type
17 | vector<int> par;
| ^~~~~~
a.cc:18:9: error: 'vector' does not name a type
18 | vector<int> rank;
| ^~~~~~
a.cc: In constructor 'Union_find::Union_find(int)':
a.cc:25:25: error: 'par' was not declared in this scope
25 | par.push_back(i);
| ^~~
a.cc:26:29: error: expected unqualified-id before '.' token
26 | rank.push_back(0);
| ^
a.cc: In member function 'int Union_find::find(int)':
a.cc:31:20: error: 'par' was not declared in this scope
31 | if(par[x] == x){
| ^~~
a.cc: In member function 'void Union_find::unite(int, int)':
a.cc:43:24: error: expected unqualified-id before '[' token
43 | if(rank[x] < rank[y]){
| ^
a.cc:44:25: error: 'par' was not declared in this scope
44 | par[x] = y;
| ^~~
a.cc:46:25: error: 'par' was not declared in this scope
46 | par[y] = x;
| ^~~
a.cc:47:32: error: expected unqualified-id before '[' token
47 | if(rank[x] == rank[y]) rank[x]++;
| ^
a.cc:47:55: error: expected initializer before '++' token
47 | if(rank[x] == rank[y]) rank[x]++;
| ^~
a.cc:47:55: error: expected ';' before '++' token
|
s959826878 | p00168 | C++ | #include <algorithm>
#include <iostream>
using namespace std;
int A[32], N;
int main(){
A[0] = 1;
for (int i=1; i<=31; i++){
A[i] = A[i-1];
if (i>1) A[i] += A[i-2];
if (i>2) A[i] += A[i-3];
}
while (cin >> N && N!=0){
year = A[N]/365+1;
cout << year << endl;
}
} | a.cc: In function 'int main()':
a.cc:13:17: error: 'year' was not declared in this scope
13 | year = A[N]/365+1;
| ^~~~
|
s562289271 | p00168 | C++ | // ConsoleApplication7.cpp : ??????????????? ??¢????????±????????§????????¨????????? ?????????????????????????????????
//
#include "stdafx.h"
#include <iostream>
#include <cstring>
using namespace std;
int n, dp[32];
int main()
{
cin.tie(0);
ios::sync_with_stdio(false);
while (cin >> n, n) {
memset(dp, 0, sizeof(dp));
dp[1] = dp[2] = dp[3] = 1;
for (int i = 1; i < n + 1; ++i) {
if (i + 3 < n + 1) {
dp[i + 3] += dp[i];
}
if (i + 2 < n + 1) {
dp[i + 2] += dp[i];
}
if (i + 1 < n + 1) {
dp[i + 1] += dp[i];
}
}
cout << dp[n] / 10 / 365 + 1<< endl;
}
return 0;
} | a.cc:4:10: fatal error: stdafx.h: No such file or directory
4 | #include "stdafx.h"
| ^~~~~~~~~~
compilation terminated.
|
s562002386 | p00168 | C++ | #include <iostream>
using namespace std;
solve(int now){
if(now==0) return 1;
if(now<0) return 0;
long long res=solve(now-1)+solve(now-2)+solve(now-3);
retrun res;
}
int main(void){
int n;
cin>>n;
solve(n);
cout<<solve(n)/3650+1<<endl;
// Your code here!
} | a.cc:3:1: error: ISO C++ forbids declaration of 'solve' with no type [-fpermissive]
3 | solve(int now){
| ^~~~~
a.cc: In function 'int solve(int)':
a.cc:7:5: error: 'retrun' was not declared in this scope
7 | retrun res;
| ^~~~~~
a.cc:6:56: warning: control reaches end of non-void function [-Wreturn-type]
6 | long long res=solve(now-1)+solve(now-2)+solve(now-3);
| ^
|
s764956989 | p00168 | C++ | #include <iostream>
using namespace std;
long long solve(int now){
if(now==0) return 1;
if(now<0) return 0;
long long res=solve(now-1)+solve(now-2)+solve(now-3);
return res;
}
int main(void){
while(cin>>n&&n){
cout<<solve(n)/3650+1<<endl;
}
// Your code here!
} | a.cc: In function 'int main()':
a.cc:10:16: error: 'n' was not declared in this scope
10 | while(cin>>n&&n){
| ^
|
s468657015 | p00168 | C++ | #include<iostream>
int main(void){
int n;
int a[31]={};
a[0]=1;
a[1]=1;
a[2]=2;
for(int i=3;i<31;i++){
a[i]=a[i-1]+a[i-2]+a[i-3];
}
while(std::cin>>n){
if(n==0) break;
std::cout<<a[i]/3650+1<<std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:22: error: 'i' was not declared in this scope
14 | std::cout<<a[i]/3650+1<<std::endl;
| ^
|
s537839382 | p00168 | C++ | #include<iostream>
int main(void){
int n;
int a[31]={};
a[0]=1;
a[1]=1;
a[2]=2;
for(int i=3;i<31;i++){
a[i]=a[i-1]+a[i-2]+a[i-3];
}
while(std::cin>>n){
if(n==0) break;
std::cout<<a[i]/3650+1<<std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:22: error: 'i' was not declared in this scope
14 | std::cout<<a[i]/3650+1<<std::endl;
| ^
|
s113115214 | p00168 | C++ | #include<iostream>
int main(void){
int n;
int a[31]={};
a[0]=1;
a[1]=1;
a[2]=2;
for(int i=3;i<31;i++){
a[i]=a[i-1]+a[i-2]+a[i-3];
}
while(std::cin>>n){
if(n==0) break;
std::cout<<a[i]/3650+1<<std::endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:22: error: 'i' was not declared in this scope
14 | std::cout<<a[i]/3650+1<<std::endl;
| ^
|
s498686429 | p00168 | C++ | #include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<cstring>
#include<sstream>
using namespace std;
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////
int main(){
unsigned long long dp[100];
dp[0] = 0;
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
rep(i,4,40){
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
//cout << i << ":" << dp[i] << endl;
}
rep(i,0,40){
if(dp[i] % 10 )
dp[i] = dp[i] / 10 + 1;
else
dp[i] = dp[i] / 10;
}
rep(i,0,40){
//cout << i << ":" << dp[i] << endl;
}
int n;
while( cin >> n ){
if( dp[n] % 365 )
cout << dp[n] / 365 + 1 << endl;
else
cout << dp[n] / 365 << endl;
}
| a.cc: In function 'int main()':
a.cc:64:10: error: expected '}' at end of input
64 | }
| ^
a.cc:36:11: note: to match this '{'
36 | int main(){
| ^
|
s472506354 | p00168 | C++ | #include <iostream>
using namespace std;
#define rep(i,x,to) for(int i=x;i<to;i++)
int main() {
int n,dp[30]={1,1,2};
while(1){
cin >> n;
if(n==0A) break;
rep(i,3,30){
dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
}
cout << dp[n]/3650+(dp[n]%3650!=0) << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:9:23: error: unable to find numeric literal operator 'operator""A'
9 | if(n==0A) break;
| ^~
|
s204335806 | p00168 | C++ | #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
int main(){
int dp[31];
int i,n:
dp[0]=1,dp[1]=1,dp[2]=2;
for(i=3;i<=30;i++){
dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
}
while(cin>>n&&n){
int ans=(dp[n]-1)/(365*10)+1;
cout<<ans<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:14:12: error: found ':' in nested-name-specifier, expected '::'
14 | int i,n:
| ^
| ::
a.cc:14:11: error: 'n' has not been declared
14 | int i,n:
| ^
a.cc:15:7: error: qualified-id in declaration before '[' token
15 | dp[0]=1,dp[1]=1,dp[2]=2;
| ^
a.cc:19:16: error: 'n' was not declared in this scope
19 | while(cin>>n&&n){
| ^
|
s044137783 | p00168 | C++ | main()
{
int n,i;
int ans[64]={0};
ans[0]=ans[1]=1;
ans[2]=2;
for(i=3;i<31;i++)
ans[i]=ans[i-1]+ans[i-2]+ans[i-3];
for(;;)
{
cin >> n ;
if(n==0)
break;
printf("%d\n",ans[n]/3650+1);
}
} | a.cc:1:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:14:17: error: 'cin' was not declared in this scope
14 | cin >> n ;
| ^~~
a.cc:17:17: error: 'printf' was not declared in this scope
17 | printf("%d\n",ans[n]/3650+1);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | main()
|
s775206453 | p00168 | C++ | int main()
{
int n,i;
int ans[64]={0};
ans[0]=ans[1]=1;
ans[2]=2;
for(i=3;i<31;i++)
ans[i]=ans[i-1]+ans[i-2]+ans[i-3];
for(;;)
{
cin >> n ;
if(n==0)
break;
printf("%d\n",ans[n]/3650+1);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:17: error: 'cin' was not declared in this scope
14 | cin >> n ;
| ^~~
a.cc:17:17: error: 'printf' was not declared in this scope
17 | printf("%d\n",ans[n]/3650+1);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int main()
|
s869638285 | p00168 | C++ | void main(){int n,i,ans[64]={0};ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)ans[i]=ans[i-1]+ans[i-2]+ans[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}} | a.cc:1:1: error: '::main' must return 'int'
1 | void main(){int n,i,ans[64]={0};ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)ans[i]=ans[i-1]+ans[i-2]+ans[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
| ^~~~
a.cc: In function 'int main()':
a.cc:1:117: error: 'scanf' was not declared in this scope
1 | void main(){int n,i,ans[64]={0};ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)ans[i]=ans[i-1]+ans[i-2]+ans[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
| ^~~~~
a.cc:1:146: error: 'printf' was not declared in this scope
1 | void main(){int n,i,ans[64]={0};ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)ans[i]=ans[i-1]+ans[i-2]+ans[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | void main(){int n,i,ans[64]={0};ans[0]=ans[1]=1;ans[2]=2;for(i=3;i<31;i++)ans[i]=ans[i-1]+ans[i-2]+ans[i-3];for(;;){scanf("%d",&n);if(n==0)break;printf("%d\n",ans[n]/3650+1);}}
|
s131740526 | p00168 | C++ | void main()
{
int n,i,ans[64];
ans[0]=ans[1]=1;
ans[2]=2;
for(i=3;i<31;i++)
ans[i]=ans[i-1]+ans[i-2]+ans[i-3];
for(;;)
{
scanf("%d",&n);
if(n==0)
break;
printf("%d\n",ans[n]/3650+1);
}
} | a.cc:1:1: error: '::main' must return 'int'
1 | void main()
| ^~~~
a.cc: In function 'int main()':
a.cc:13:17: error: 'scanf' was not declared in this scope
13 | scanf("%d",&n);
| ^~~~~
a.cc:16:17: error: 'printf' was not declared in this scope
16 | printf("%d\n",ans[n]/3650+1);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | void main()
|
s180801978 | p00168 | C++ | void main()
{
int n,i;
int ans[64]={0};
ans[0]=ans[1]=1;
ans[2]=2;
for(i=3;i<31;i++)
ans[i]=ans[i-1]+ans[i-2]+ans[i-3];
for(;;)
{
scanf("%d",&n);
if(n==0)
break;
printf("%d\n",ans[n]/3650+1);
}
} | a.cc:1:1: error: '::main' must return 'int'
1 | void main()
| ^~~~
a.cc: In function 'int main()':
a.cc:14:17: error: 'scanf' was not declared in this scope
14 | scanf("%d",&n);
| ^~~~~
a.cc:17:17: error: 'printf' was not declared in this scope
17 | printf("%d\n",ans[n]/3650+1);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | void main()
|
s598816632 | p00168 | C++ | #include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef ll long long int
ll rr(int ll){
if(y==0)
return 1;
else return y*rr(y-1);
}
ll func(ll i,ll j,ll k){
return rr(i+j+k)/(rr(i)*rr(j)*rr(k));
}
int main(){
ll n,sum,k;
while(cin>>n,n){
sum=0;
for(ll i=0;i*3<=n;i++)
for(ll j=0;j*2+3*i<=n;j++){
k=n-(j*2+3*i);
sum+=func(i,j,k);
}
if(sum%3650>0)
cout<<sum/3650+1<<endl;
else
cout<<sum/3650<<endl;
}
return 0;
} | a.cc:4:9: error: 'll' does not name a type
4 | typedef ll long long int
| ^~
a.cc:10:1: error: 'll' does not name a type
10 | ll func(ll i,ll j,ll k){
| ^~
a.cc: In function 'int main()':
a.cc:14:9: error: 'll' was not declared in this scope
14 | ll n,sum,k;
| ^~
a.cc:15:20: error: 'n' was not declared in this scope
15 | while(cin>>n,n){
| ^
a.cc:16:17: error: 'sum' was not declared in this scope
16 | sum=0;
| ^~~
a.cc:17:23: error: expected ';' before 'i'
17 | for(ll i=0;i*3<=n;i++)
| ^~
| ;
a.cc:17:28: error: 'i' was not declared in this scope
17 | for(ll i=0;i*3<=n;i++)
| ^
a.cc:18:23: error: expected ';' before 'j'
18 | for(ll j=0;j*2+3*i<=n;j++){
| ^~
| ;
a.cc:18:28: error: 'j' was not declared in this scope
18 | for(ll j=0;j*2+3*i<=n;j++){
| ^
a.cc:19:25: error: 'k' was not declared in this scope
19 | k=n-(j*2+3*i);
| ^
a.cc:20:30: error: 'func' was not declared in this scope
20 | sum+=func(i,j,k);
| ^~~~
|
s628512743 | p00168 | C++ | #include <iostream>
using namespace std;
int fib[100];
int fibonacci(int n){
if(!fib[n]) fib[n] = fibonacci(n-1) + fibonacci(n-2) + fibonacci(n-3);
return fib[n];
}
int main(){
int n;
memset(fib, 0, sizeof(fib));
fib[0] = fib[1] = 1;
fib[2] = 2;
while((cin >> n), n){
cout << (fibonacci(n)/3650 + 1) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:3: error: 'memset' was not declared in this scope
13 | memset(fib, 0, sizeof(fib));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s364528531 | p00168 | C++ | #include <iostream>
using namespace std;
int dp[31];
const int DIV = 3650;
int main(void)
{
while(1){
int num;
cin >> num;
if(num == 0)
return 0;
memset(dp,0,sizeof(dp));
dp[0] = 1;
for(int i=1;i<=num;++i){//どの段から?
for(int j=1;j<=3;++j){//何段?
if(i-j < 0)
continue;
dp[i] += dp[i-j];
}
}
cout << ceil((double)dp[num]/DIV) << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset(dp,0,sizeof(dp));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 | using namespace std;
a.cc:24:25: error: 'ceil' was not declared in this scope
24 | cout << ceil((double)dp[num]/DIV) << endl;
| ^~~~
|
s835685956 | p00168 | C++ | #include <iostream>
using namespace std;
int p[100];
int main(){
p[1] = 1;
p[2] = 2;
p[3] = 4;
for(int i = 4; i <= 30; i++){
p[i] = p[i-1] + p[i-2] + p[i-3];
}
int n;
while(cin >> n, n){Q
cout << p[n]/3650+1 << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:28: error: 'Q' was not declared in this scope
16 | while(cin >> n, n){Q
| ^
|
s214625666 | p00168 | C++ | #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>
using namespace std;
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}
typedef long long ll;
int main()
{
int dp[32] = {0}, n;
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i < 31; i++)
{
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
while(cin >> n, n)
{
cout << (dp[n]/365)10 + 1 << endl;
}
} | a.cc: In function 'int main()':
a.cc:41:36: error: expected ';' before numeric constant
41 | cout << (dp[n]/365)10 + 1 << endl;
| ^~
| ;
|
s279631672 | p00168 | C++ | #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>
using namespace std;
inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}
typedef long long ll;
int main()
{
int dp[32], n;
dp[0] = 1;
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i < 31; i++)
{
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
while(cin >> n, n)
{
cout << (dp[n]/365)10 + 1 << endl;
}
} | a.cc: In function 'int main()':
a.cc:41:36: error: expected ';' before numeric constant
41 | cout << (dp[n]/365)10 + 1 << endl;
| ^~
| ;
|
s862902131 | p00168 | C++ | include <iostream>
#include <algorithm>
using namespace std;
long long dp[33];
int main() {
int n;
while( cin >> n, n ) {
fill(dp, dp+32, 0);
dp[0] = 1, dp[1] = 1, dp[2] = 2;
for(int i=3; i<=n; i++) {
dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
}
cout << dp[n]/3650+1 << endl;
}
return 0;
} | 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 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'
164 | __is_null_pointer(std::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:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::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:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/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'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/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'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/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:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
|
s805408572 | p00168 | C++ | #include<iostream>
using namespace std;
int main(){
int n;
int dp[32];
int ans;
memset(dp, 0, sizeof(dp));
while(n>0){
cin >> n;
for(int i=1; i<=n; i++){
if(i==1 || i==2 ){dp[i] = i;}
else if(i==3){dp[i] = 4;}
else{
dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
}
}
ans = dp[n] / 3650;
if(dp[n]%3650 != 0){
ans++;
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:9: error: 'memset' was not declared in this scope
11 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 |
|
s650822960 | p00168 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
int n;
int dp[32];
int ans;
memset(dp, 0, sizeof(dp));
while(n>0){
cin >> n;
for(int i=1; i<=n; i++){
if(i==1 || i==2 ){dp[i] = i;}
else if(i==3){dp[i] = 4;}
else{
dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
}
}
ans = dp[n] / 3650;
if(dp[n]%3650 != 0){
ans++;
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'memset' was not declared in this scope
12 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | #include<string>
|
s202365509 | p00168 | C++ | include<iostream>
using namespace std;
int main(){
int n,c=0;
while(true){
cin>>n;
if(n==0)
break;
int dp[n+1];
for(int i=0;i<n+1;i++){
if(i==0){
dp[i]=1;
}
if(i==1){
dp[i]=1;
}
if(i==2){
dp[i]=2;
}
}
for(int i=3;i<n+1;i++){
dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
}
if(c==0){
cout<<endl;
++c;
}
cout<<dp[n]/3650+1<<endl;
}
} | a.cc:1:1: error: 'include' does not name a type
1 | include<iostream>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:7:3: error: 'cin' was not declared in this scope
7 | cin>>n;
| ^~~
a.cc:27:5: error: 'cout' was not declared in this scope
27 | cout<<endl;
| ^~~~
a.cc:27:11: error: 'endl' was not declared in this scope
27 | cout<<endl;
| ^~~~
a.cc:30:3: error: 'cout' was not declared in this scope
30 | cout<<dp[n]/3650+1<<endl;
| ^~~~
a.cc:30:23: error: 'endl' was not declared in this scope
30 | cout<<dp[n]/3650+1<<endl;
| ^~~~
|
s407380358 | p00168 | C++ | #include <iostream>
using namespace std;
int main() {
int a[100]={0};
a[0]=1;
a[1]=1;
a[2]=2;
int n;
while(cin <<n){
int x;
x=0;
for(int i=3;i<n;i++){
a[i]=a[i-3]+a[i-2]+a[i-1];
}
x=a[n]%3650;
x=x+1;
cout >> x;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:15: error: no match for 'operator<<' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'int')
10 | while(cin <<n){
| ~~~ ^~~
| | |
| | int
| std::istream {aka std::basic_istream<char>}
a.cc:10:15: note: candidate: 'operator<<(int, int)' (built-in)
10 | while(cin <<n){
| ~~~~^~~
a.cc:10:15: note: no known conversion for argument 1 from 'std::istream' {aka 'std::basic_istream<char>'} to 'int'
In file included 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/string_view:763:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, basic_string_view<_CharT, _Traits>)'
763 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/string_view:763:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/bits/basic_string.h:4077:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
4077 | operator<<(basic_ostream<_CharT, _Traits>& __os,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4077:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:125:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator<<(byte, _IntegerType)'
125 | operator<<(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:125:5: note: template argument deduction/substitution failed:
a.cc:10:11: note: cannot convert 'std::cin' (type 'std::istream' {aka 'std::basic_istream<char>'}) to type 'std::byte'
10 | while(cin <<n){
| ^~~
In file included from /usr/include/c++/14/bits/ios_base.h:46:
/usr/include/c++/14/system_error:339:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)'
339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e)
| ^~~~~~~~
/usr/include/c++/14/system_error:339:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:563:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)'
563 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:563:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:573:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)'
573 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:573:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:579:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)'
579 | operator<<(basic_ostream<char, _Traits>& __out, char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:579:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:590:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)'
590 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:590:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:595:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)'
595 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c)
| ^~~~~~~~
/usr/include/c++/14/ostream:595:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:654:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)'
654 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:654:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:307:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)'
307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<_CharT, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:671:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)'
671 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:671:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:684:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)'
684 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:684:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:689:5: note: candidate: 'template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)'
689 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/ostream:689:5: note: template argument deduction/substitution failed:
a.cc:10:17: note: 'std::istream' {aka 'std::basic_istream<char>'} is not derived from 'std::basic_ostream<char, _Traits>'
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:810:5: note: candidate: 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
/usr/include/c++/14/ostream:810:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/ostream: In substitution of 'template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]':
a.cc:10:17: required from here
10 | while(cin <<n){
| ^
/usr/include/c++/14/ostream:810:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
810 | operator<<(_Ostream&& __os, const _Tp& __x)
| ^~~~~~~~
a.cc:18:10: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'int')
18 | cout >> x;
| ~~~~ ^~ ~
| | |
| | int
| std::ostream {aka std::basic_ostream<char>}
a.cc:18:10: note: candidate: 'operator>>(int, int)' (built-in)
18 | cout >> x;
| ~~~~~^~~~
a.cc:18:10: note: no known conversion |
s037519021 | p00168 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int n;
int dp[35][35];
void solve() {
memset(dp, 0, sizeof(dp));
dp[0][0] = 1;
for (int i=0; i<n; i++) {
for (int j=0; j<=n; j++) {
if (j>=1) dp[i+1][j] += dp[i][j-1];
if (j>=2) dp[i+1][j] += dp[i][j-2];
if (j>=3) dp[i+1][j] += dp[i][j-3];
}
}
int sum = 0;
for (int i=0; i<n; i++) {
sum += dp[i+1][n];
}
sum /= 10;
int ans = ceil((double)sum/365.0);
if (sum > 0) cout << ans << endl;
else cout << 1 << endl;
}
int main() {
while (1) {
cin >> n; if (n==0) break;
solve();
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:11:9: error: 'memset' was not declared in this scope
11 | memset(dp, 0, sizeof(dp));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <cmath>
+++ |+#include <cstring>
3 |
|
s703427119 | p00169 | Java | import java.util.Arrays;
import java.util.Scanner;
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
for (;;) {
String[] s = sc.nextLine().split(" ");
int n = s.length;
int[] l = new int[n];
for (int i = 0; i < n; i++)
l[i] = Integer.parseInt(s[i]);
if (l[0] == 0)
break;
Arrays.sort(l);
int sum = 0;
while (n-- > 0)
sum+=l[n]!=1?Math.min(10,l[n]):sum+n<=10?11:1;
System.out.println(sum>21?0:sum);
}
}
}
| Main.java:4: error: class A is public, should be declared in a file named A.java
public class A {
^
1 error
|
s429885611 | p00169 | C | #include<stdio.h>
#include<math.h>
int main(){
int score = 0;
int point = 0;
for (score = 0; score < 21;)
{
if (score > 21)
{
score = 0;
}
else
{
scanf_s("%d", &point);
if (point == 1)
{
if (score < 11)
{
point = 11;
}
}
score += point;
printf("現在のスコア = %d", score);
}
}
return 0;
} | main.c: In function 'main':
main.c:18:25: error: implicit declaration of function 'scanf_s'; did you mean 'scanf'? [-Wimplicit-function-declaration]
18 | scanf_s("%d", &point);
| ^~~~~~~
| scanf
|
s237521312 | p00169 | C | #include<cstdio>
#include<sstream>
#define MAX(x,y) ((x>y)?x:y)
using namespace std;
int main(){
int i,j,x,sum,f,ans;
char s[200];
while(fgets(s,200,stdin)!=NULL){
istringstream ss(s);
f=sum=0;
while(ss>>x){
if(x==0)goto fin;
if(x==1)f++;
else if(x>9)sum+=10;
else sum+=x;
}
ans=0;
for(i=0;i<=f;i++){
x=sum+i+11*(f-i);
if(x>21)x=0;
ans=MAX(ans,x);
}
printf("%d\n",ans);
}
fin:
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s787996032 | p00169 | C++ | #include<bits/stdc++.h>
using namespace std;
int power(int n)
{
???int num=1;
???for(int i=0;i<n;i++)num*=10;
???return num;
}
int serch(int sum,int n)
{
???if(sum>21)return 0;
???else if(n==0)return sum;
???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
}
int main()
{
???string str;
???while(getline(cin,str)){
??????if(str[0]=='0')break;
??????int card[1000]={},co=0,point=0;
??????for(int i=0;;i++){
?????????if(str[i]==' '||str[i]=='\0'){
????????????for(int j=point;j<i;j++)card[co]+=(str[j]-'0')*power(i-1-j);
????????????co++;point=i+1;
?????????}
?????????if(str[i]=='\0')break;
??????}
??????int cou=0,sum=0;
??????for(int i=0;i<co;i++){
?????????if(card[i]==1)cou++;
?????????else if(card[i]<10)sum+=card[i];
?????????else sum+=10;
??????}
??????cout<<serch(sum,cou)<<endl;
???}
} | a.cc: In function 'int power(int)':
a.cc:5:1: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:2: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:3: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:6:1: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:16: error: 'i' was not declared in this scope
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:7:1: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
8 | }
| ^
a.cc: In function 'int serch(int, int)':
a.cc:11:1: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:2: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:3: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:12:1: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:2: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:3: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:13:1: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:2: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:3: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
a.cc: In function 'int main()':
a.cc:17:1: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:2: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:3: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:11: error: expected primary-expression before 'str'
17 | ???string str;
| ^~~
a.cc:17:10: error: expected ':' before 'str'
17 | ???string str;
| ^~~~
| :
a.cc:17:11: error: 'str' was not declared in this scope; did you mean 'std'?
17 | ???string str;
| ^~~
| std
a.cc:17:14: error: expected ':' before ';' token
17 | ???string str;
| ^
| :
a.cc:17:14: error: expected primary-expression before ';' token
a.cc:17:14: error: expected ':' before ';' token
17 | ???string str;
| ^
| :
a.cc:17:14: error: expected primary-expression before ';' token
a.cc:18:1: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:2: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:3: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
|
s734757297 | p00169 | C++ | #include<bits/stdc++.h>
using namespace std;
int power(int n)
{
???int num=1;
???for(int i=0;i<n;i++)num*=10;
???return num;
}
int serch(int sum,int n)
{
???if(sum>21)return 0;
???else if(n==0)return sum;
???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
}
int main()
{
???string str;
???while(getline(cin,str)){
??????if(str[0]=='0')break;
??????int card[1000]={},co=0,point=0;
??????for(int i=0;;i++){
?????????if(str[i]==' '||str[i]=='\0'){
????????????for(int j=point;j<i;j++)card[co]+=(str[j]-'0')*power(i-1-j);
????????????co++;point=i+1;
?????????}
?????????if(str[i]=='\0')break;
??????}
??????int cou=0,sum=0;
??????for(int i=0;i<co;i++){
?????????if(card[i]==1)cou++;
?????????else if(card[i]<10)sum+=card[i];
?????????else sum+=10;
??????}
??????cout<<serch(sum,cou)<<endl;
???}
} | a.cc: In function 'int power(int)':
a.cc:5:1: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:2: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:3: error: expected primary-expression before '?' token
5 | ???int num=1;
| ^
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:5:4: error: expected ':' before 'int'
5 | ???int num=1;
| ^~~
| :
a.cc:5:4: error: expected primary-expression before 'int'
5 | ???int num=1;
| ^~~
a.cc:6:1: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:2: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:3: error: expected primary-expression before '?' token
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:4: error: expected ':' before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
| :
a.cc:6:4: error: expected primary-expression before 'for'
6 | ???for(int i=0;i<n;i++)num*=10;
| ^~~
a.cc:6:16: error: 'i' was not declared in this scope
6 | ???for(int i=0;i<n;i++)num*=10;
| ^
a.cc:7:1: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:2: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:3: error: expected primary-expression before '?' token
7 | ???return num;
| ^
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:7:4: error: expected ':' before 'return'
7 | ???return num;
| ^~~~~~
| :
a.cc:7:4: error: expected primary-expression before 'return'
7 | ???return num;
| ^~~~~~
a.cc:8:1: warning: no return statement in function returning non-void [-Wreturn-type]
8 | }
| ^
a.cc: In function 'int serch(int, int)':
a.cc:11:1: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:2: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:3: error: expected primary-expression before '?' token
11 | ???if(sum>21)return 0;
| ^
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:11:4: error: expected ':' before 'if'
11 | ???if(sum>21)return 0;
| ^~
| :
a.cc:11:4: error: expected primary-expression before 'if'
11 | ???if(sum>21)return 0;
| ^~
a.cc:12:1: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:2: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:3: error: expected primary-expression before '?' token
12 | ???else if(n==0)return sum;
| ^
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:12:4: error: expected ':' before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
| :
a.cc:12:4: error: expected primary-expression before 'else'
12 | ???else if(n==0)return sum;
| ^~~~
a.cc:13:1: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:2: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:3: error: expected primary-expression before '?' token
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:13:4: error: expected ':' before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
| :
a.cc:13:4: error: expected primary-expression before 'else'
13 | ???else return max(serch(sum+11,n-1),serch(sum+1,n-1));
| ^~~~
a.cc:14:1: warning: no return statement in function returning non-void [-Wreturn-type]
14 | }
| ^
a.cc: In function 'int main()':
a.cc:17:1: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:2: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:3: error: expected primary-expression before '?' token
17 | ???string str;
| ^
a.cc:17:11: error: expected primary-expression before 'str'
17 | ???string str;
| ^~~
a.cc:17:10: error: expected ':' before 'str'
17 | ???string str;
| ^~~~
| :
a.cc:17:11: error: 'str' was not declared in this scope; did you mean 'std'?
17 | ???string str;
| ^~~
| std
a.cc:17:14: error: expected ':' before ';' token
17 | ???string str;
| ^
| :
a.cc:17:14: error: expected primary-expression before ';' token
a.cc:17:14: error: expected ':' before ';' token
17 | ???string str;
| ^
| :
a.cc:17:14: error: expected primary-expression before ';' token
a.cc:18:1: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:2: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:3: error: expected primary-expression before '?' token
18 | ???while(getline(cin,str)){
| ^
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
a.cc:18:4: error: expected ':' before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
| :
a.cc:18:4: error: expected primary-expression before 'while'
18 | ???while(getline(cin,str)){
| ^~~~~
|
s625155652 | p00169 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(getline(cin,s),s!="0"){
stringstream ss(s);
int x=0,i,ans;
int si=0;
vector<int> v;
v.clear();
v.push_back(0);
while(ss>>x){
si=v.size();
for(i=0;i<si;i++){
if(x==1){
k=v[i];
v.push_back(k+11);
v[i]++;
}else if(x>10){
v[i]+=10;
}else {
v[i]+=x;
}
}
}
sort(v.begin(),v.end());
ans=0;
for(i=0;i<v.size();i++){
if(v[i]<=21) ans=v[i];
}
cout << ans << endl;
s="";
}
return 0;
} | a.cc: In function 'int main()':
a.cc:18:11: error: 'k' was not declared in this scope
18 | k=v[i];
| ^
|
s176045833 | p00169 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
while(getline(cin,s)&&s!="0"){
s.push_back(' ');
int one=0;
int sum=0;
string a;
for(int i=0;i<s.size();i++){
if(s[i]==' '){
int b=to_string(a);
if(b==1)one++;
else if(b>10)sum+=10;
else sum+=b;
}
else a.push_back(s[i]);
}
int dp[114][23]={};
dp[0][max(22,sum)]=1;
for(int i=1;i<=one;i++){
for(int j=0;j<22;j++){
dp[i][j+1]=dp[i][j];
dp[i][max(22,j+11)]=dp[i][j];
}
}
int ans=0;
for(int i=0;i<22;i++){
if(dp[one][i])ans=i;
}
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:48: error: no matching function for call to 'to_string(std::string&)'
14 | int b=to_string(a);
| ~~~~~~~~~^~~
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:4240:3: note: candidate: 'std::string std::__cxx11::to_string(int)'
4240 | to_string(int __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4240:17: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int'
4240 | to_string(int __val)
| ~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4259:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)'
4259 | to_string(unsigned __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4259:22: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'unsigned int'
4259 | to_string(unsigned __val)
| ~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4275:3: note: candidate: 'std::string std::__cxx11::to_string(long int)'
4275 | to_string(long __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4275:18: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'long int'
4275 | to_string(long __val)
| ~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4294:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)'
4294 | to_string(unsigned long __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4294:27: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'long unsigned int'
4294 | to_string(unsigned long __val)
| ~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4310:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)'
4310 | to_string(long long __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4310:23: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'long long int'
4310 | to_string(long long __val)
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4327:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)'
4327 | to_string(unsigned long long __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4327:32: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'long long unsigned int'
4327 | to_string(unsigned long long __val)
| ~~~~~~~~~~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4401:3: note: candidate: 'std::string std::__cxx11::to_string(float)'
4401 | to_string(float __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4401:19: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'float'
4401 | to_string(float __val)
| ~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4411:3: note: candidate: 'std::string std::__cxx11::to_string(double)'
4411 | to_string(double __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4411:20: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'double'
4411 | to_string(double __val)
| ~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:4421:3: note: candidate: 'std::string std::__cxx11::to_string(long double)'
4421 | to_string(long double __val)
| ^~~~~~~~~
/usr/include/c++/14/bits/basic_string.h:4421:25: note: no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'long double'
4421 | to_string(long double __val)
| ~~~~~~~~~~~~^~~~~
|
s205880943 | p00169 | C++ | #include<bits/stdc++.h>
using namespace std;
int stoi(string a){
int ret;
stringstream ss;
ss<<a;
ss>>ret;
return ret;
}
int main(){
string s;
while(getline(cin,s)&&s!="0"){
s.push_back(' ');
int one=0;
int sum=0;
string a;
for(int i=0;i<s.size();i++){
if(s[i]==' '){
int b=stoi(a);
if(b==1)one++;
else if(b>10)sum+=10;
else sum+=b;
a.clear();
}
else a.push_back(s[i]);
}
sum+=one;
for(int i=0;i<one;i++){
if(sum<12)sum+=10;
}
if(sum>21)sum=0;
cout<<sum<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:43: error: call of overloaded 'stoi(std::string&)' is ambiguous
22 | int b=stoi(a);
| ~~~~^~~
a.cc:4:5: note: candidate: 'int stoi(std::string)'
4 | int stoi(string a){
| ^~~~
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: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)
| ^~~~
|
s960953624 | p00169 | C++ |
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
int main()
{
string s;
char *c;
int i, score, ace;
while (getline(cin,s)) {
if (s[0]=='0') break;
score = 0;
ace = 0;
c = strtok((char*)s.c_str(), " ");
while (c != NULL) {
if (atoi(c) > 9) score += 10;
else score += atoi(c);
if (atoi(c) == 1) ace++;
c = strtok(NULL, " ");
}
while (ace--) {
if (score + 10 > 21) break;
score += 10;
}
if (score > 21) score = 0;
cout<<score<<endl;
}
} | a.cc: In function 'int main()':
a.cc:16:9: error: 'strtok' was not declared in this scope; did you mean 'strtoq'?
16 | c = strtok((char*)s.c_str(), " ");
| ^~~~~~
| strtoq
|
s924730647 | p00169 | C++ | #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
char c[256];
int d[100],i,s,p,f;
while(true) {
for (i=0;i<255;i++) c[i]=1;
i=p=0;
gets(c);
if (c[0]=='0') break;
while(true) {
if (c[p+2]==' ' || c[p+2]=='\0') { d[i]=(c[p]-'0')*10+(c[p+1]-'0'); p+=3;}
else if (c[p+1]==' ' || c[p+1]=='\0') { d[i]=(c[p]-'0'); p+=2;}
if (c[p-1]=='\0') break;
i++;
}
for (s=0,f=0;i>=0;i--) if (d[i]>0 && d[i]<10) { s+=d[i]; if (d[i]==1) f=1;} else s+=10;
if (f==1 && s+10<22) s+=10;
if (s>21) s=0;
cout << s << endl;
}
return 0;
| a.cc: In function 'int main()':
a.cc:10:2: error: 'gets' was not declared in this scope; did you mean 'getw'?
10 | gets(c);
| ^~~~
| getw
a.cc:23:11: error: expected '}' at end of input
23 | return 0;
| ^
a.cc:4:12: note: to match this '{'
4 | int main() {
| ^
|
s758544186 | p00169 | C++ | 1#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;
#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define F first
#define S second
#define INF 1 << 30
typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;
int a[14], p;
int main(){
char str[128];
while(fgets(str, sizeof(str), stdin) && str[0] != '0'){
memset(a, 0, sizeof(a));
char *tp;
tp = strtok(str, " ");
while(tp != NULL){
a[atoi(tp)]++;
tp = strtok(NULL, " ");
}
// rep(i, p) printf("%d ", a[i]); puts("");
int res = 0;
a[10] += a[11]; a[10] += a[12]; a[10] += a[13];
REP(i, 2, 11) res += a[i]*i;
// printf("%d\n", res);
// printf("%d\n", a[1]);
int one = 11*a[1];
while(res+one > 21 && one != a[1]){
one -= 10;
}
// printf("%d\n", res+one);
res += one;
if(res > 21) res = 0;
printf("%d\n", res);
}
return 0;
} | a.cc:1:2: error: stray '#' in program
1 | 1#include <iostream>
| ^
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1#include <iostream>
| ^
In file included from /usr/include/c++/14/cmath:45,
from a.cc:5:
/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'
164 | __is_null_pointer(std::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,
from /usr/include/c++/14/bits/specfun.h:43,
from /usr/include/c++/14/cmath:3906:
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::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)>
| ^~~~~~
In file included from /usr/include/stdio.h:34,
from /usr/include/c++/14/cstdio:42,
from a.cc:2:
/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_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/in |
s419870720 | p00170 | Java | import java.util.*;
public class Main {
int n, sum;
String[] f;
int[] w, s, memo, ans;
double min;
public void loop(int m, int gsum, int wsum){
if(m==n){
if(min>(double)gsum/wsum){
min = (double)gsum/wsum;
for(int i=0;i<n;i++) ans[i] = memo[i];
}
return;
}
for(int i=0;i<n;i++){
boolean flag = true;
for(int j=0;j<m;j++){
if(memo[j]==i) flag = false;
}
if(flag==true){
memo[m] = i;
if(sum-wsum-w[i]<=s[i]){
loop(m+1, gsum+(m+1)*w[i], wsum+w[i]);
}
}
}
}
public void run(){
Scanner sc = new Scanner(System.in);
while(true){
n = sc.nextInt();
if(n==0) break;
f = new String[n];
w = new int[n];
s = new int[n];
memo = new int[n];
Arrays.fill(memo, -1);
ans = new int[n];
sum = 0;
min = Integer.MAX_VALUE;
for(int i=0;i<n;i++){
f[i] = sc.next();
w[i] = sc.nextInt();
s[i] = sc.nextInt();
sum += w[i];
}
loop(0,0,0);
for(int i=0;i<n;i++) System.out.println(f[ans[i]]);
}
}
public static void main(String[] args) {
new Main.run();
}
} | Main.java:59: error: cannot find symbol
new Main.run();
^
symbol: class run
location: class Main
1 error
|
s072529258 | p00170 | C++ | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <sstream>
using namespace std;
const int MAX= 10000100;
#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}
struct food{
string fn;
int g;
int s;
};
int f[10],an[10],m;
food fd[10],sf;
int ans(int n,int s){
if(n==-1){
for(int i = m - 1 ; i >= 0 ; i --)
cout << fd[an[i]].fn << endl;
return 1;
}
for (i=m-1;i>=0;i--) {
if (f[i]==0 && fd[i].s>=s-fd[i].g) {
f[i]=1; an[n]=i;
if (ans(n-1,s-fd[i].g)==1) return 1;
f[i]=0;
}
}
return 0;
}
int main(void){
int i,j,s;
while(cin>>m){
if(m==0)break;
for(i = 0 , s = 0 ; i < m ; i ++){
f[i] = 0 ;
cin>>fd[i].fn>>fd[i].g>>fd[i].s;
s+=fd[i].g;
}
for(i = 1 ; i < m ; i ++){
for(j = 0 ; j < m - i ; j ++){
if(fd[j].g>fd[j+1].g){
sf=fd[j];
fd[j] = fd[j+1];
fd[j+1] = sf;
}
}
}
ans(m-1,s);
}
return 0;
} | a.cc: In function 'int ans(int, int)':
a.cc:36:7: error: 'i' was not declared in this scope
36 | for (i=m-1;i>=0;i--) {
| ^
|
s410265468 | p00170 | C++ | #include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;
int n, w[1000], s[1000];
string S[1000]; vector<int>b; int maxn = 100000000;
int main() {
cin >> n;
for (int i = 0; i < n; i++) {
cin >> S[i] >> w[i] >> s[i];
}
vector<int>a(n, 0);
for (int i = 0; i < n; i++)a[i] = i;
do {
for (int i = 0; i < n; i++) {
int sum = 0;
for (int j = i + 1; j < n; j++) {
sum += w[a[j]];
}
if (sum > s[i]) goto E;
}
int sum2 = 0;
for (int i = 0; i < n; i++)sum2 += i*w[i];
if (maxn > sum2)b = a;
E:;
} while (next_permutation(a.begin(), a.end()));
for (int i = 0; i < n; i++)cout << S[a[i]] << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:26:9: error: jump to label 'E'
26 | E:;
| ^
a.cc:21:46: note: from here
21 | if (sum > s[i]) goto E;
| ^
a.cc:23:21: note: crosses initialization of 'int sum2'
23 | int sum2 = 0;
| ^~~~
|
s481760686 | p00170 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n,sum,ret;
int info[10][10];
vector<int> data;
while(cin >> n && n){
data.clear();
rep(i,n)data.push_back(i);
rep(i,10)rep(j,10)info[i][j] = 0 ;
rep(i,n)rep(j,n){
cin >> info[i][j];
info[j][i] = info[i][j] = max(info[i][j],info[j][i]);
}
rep(i,n){
rep(j,n)cout << info[i][j] << " " ;
cout << endl;
}
ret = INT_MAX;
do{
sum = 0;
for(int i=0;i+1<n;i++){
for(int i=0;i
sum += info[data[i]][data[i+1]];
}
cout << "("<< data[n-1] << ") = " << sum << endl;
ret = min(ret,sum);
}while(next_permutation(data.begin(),data.end()));
cout << ret << endl;
}
} | a.cc: In function 'int main()':
a.cc:28:46: error: expected ';' before 'sum'
28 | for(int i=0;i
| ^
| ;
29 | sum += info[data[i]][data[i+1]];
| ~~~
a.cc:29:64: error: expected ')' before ';' token
29 | sum += info[data[i]][data[i+1]];
| ^
| )
a.cc:28:36: note: to match this '('
28 | for(int i=0;i
| ^
|
s802796557 | p00170 | C++ | #include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef pair<pair<int,int>,string> item;
main(){
int n,i,w,s,S;
string f;
for(;cin>>n,n;){
vector<item> items,result;
for(i=0;i<n;i++)cin>>f>>w>>s,items.push_back(make_pair(make_pair(w,s),f));
sort(items.begin(),items.end());
S=999999999;
do{
for(s=w=i=0;i<n;i++){ //from upper
if(items[i].first.second<w)break;
w+=items[i].first.first;
s+=(n-i)*items[i].first.first;
}
if(i==n&&s<S)cout<<s<<endl,S=s,result=items;
}while(next_permutation(items.begin(),items.end()));
reverse(result.begin(),result.end());
for(i=0;i<n;i++)cout<<result[i].second<<endl;
}
} | a.cc:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:12:17: error: 'sort' was not declared in this scope; did you mean 'short'?
12 | sort(items.begin(),items.end());
| ^~~~
| short
a.cc:21:24: error: 'next_permutation' was not declared in this scope
21 | }while(next_permutation(items.begin(),items.end()));
| ^~~~~~~~~~~~~~~~
a.cc:22:17: error: 'reverse' was not declared in this scope
22 | reverse(result.begin(),result.end());
| ^~~~~~~
|
s455550710 | p00171 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
string pat[24] =
{
"123","135","154","142",
"231","214","246","263",
"326","365","351","312",
"421","415","456","462",
"513","536","564","541",
"624","645","653","632"
};
string dice[8];
bool used[8];
int select[8];
int num[8];
bool check(int d1, int pos1, int d2, int pos2) {
char c1 = dice[select[d1]][pat[num[d1]][pos1 - 1] - '1'];
char c2 = dice[select[d2]][pat[num[d2]][pos2 - 1] - '1'];
return c1 != c2 && (c1 - 32 == c2 || c2 - 32 == c1);
}
bool dfs(int p) {
if (p == 8) return true;
REP(i, 8) if (!used[i]) {
used[i] = true;
select[p] = i;
REP(j, 24) {
num[p] = j;
bool flag = false;
switch (p) {
case 0: flag = true; break;
case 1: if (check(0, 3, 1, 4)) flag = true; break;
case 2: if (check(0, 2, 2, 5)) flag = true; break;
case 3: if (check(1, 2, 3, 5) && check(2, 3, 3, 4)) flag = true; break;
case 4: if (check(0, 6, 4, 1)) flag = true; break;
case 5: if (check(1, 6, 5, 1) && check(4, 3, 5, 4)) flag = true; break;
case 6: if (check(4, 2, 6, 5) && check(2, 6, 6, 1)) flag = true; break;
case 7: if (check(6, 3, 7, 4) && check(5, 2, 7, 5) && check(3, 6, 7, 1)) flag = true; break;
}
if (flag && dfs(p + 1)) return true;
}
used[i] = false;
}
return false;
}
int main() {
REP(i, 24) {
for (int j = 2; j >= 0; j--) pat[i] += (7 - (pat[i][j] - '0')) + '0';
}
while (cin >> dice[0]) {
if (dice[0] == "0") break;
FOR(i, 1, 8) cin >> dice[i];
memset(used, 0, sizeof(used));
if (dfs(0)) puts("YES");
else puts("NO");
}
return 0;
} | a.cc:19:13: error: 'int select [8]' redeclared as different kind of entity
19 | int select[8];
| ^
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
from /usr/include/stdlib.h:514,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:42,
from a.cc:1:
/usr/include/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
102 | extern int select (int __nfds, fd_set *__restrict __readfds,
| ^~~~~~
a.cc: In function 'bool check(int, int, int, int)':
a.cc:23:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
23 | char c1 = dice[select[d1]][pat[num[d1]][pos1 - 1] - '1'];
| ^
a.cc:23:23: error: invalid types 'std::string [8] {aka std::__cxx11::basic_string<char> [8]}[int(int, fd_set*, fd_set*, fd_set*, timeval*)]' for array subscript
23 | char c1 = dice[select[d1]][pat[num[d1]][pos1 - 1] - '1'];
| ^
a.cc:24:33: warning: pointer to a function used in arithmetic [-Wpointer-arith]
24 | char c2 = dice[select[d2]][pat[num[d2]][pos2 - 1] - '1'];
| ^
a.cc:24:23: error: invalid types 'std::string [8] {aka std::__cxx11::basic_string<char> [8]}[int(int, fd_set*, fd_set*, fd_set*, timeval*)]' for array subscript
24 | char c2 = dice[select[d2]][pat[num[d2]][pos2 - 1] - '1'];
| ^
a.cc: In function 'bool dfs(int)':
a.cc:33:25: warning: pointer to a function used in arithmetic [-Wpointer-arith]
33 | select[p] = i;
| ^
a.cc:33:27: error: assignment of read-only location '*(select + ((sizetype)p))'
33 | select[p] = i;
| ~~~~~~~~~~^~~
|
s732368663 | p00171 | C++ |
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
std::vector<std::string> buf(8);
//Eñ]ÉiÞûüųÊÌCfbNXÆAEÌCfbNXðwèµÄãÌCfbNXðÔ·
int uppderindex(int front, int right){
int table[][6] = {
{0, 3, 5, 2, 4, 0},
{4, 0, 1, 6, 0, 3},
{2, 6, 0, 0, 1, 5},
{5, 1, 0, 0, 6, 2},
{3, 0, 6, 1, 0, 4},
{0, 4, 2, 5, 3, 0}
};
return table[front][right]-1;
}
//½Î¤ÌCfbNXðÔ·
int otherindex(int h){
return 5-h;
}
int otherc(int c){
return c+(c>96?-32:32);
}
//³ÊðwèµÄOüÌCfbNXðÔ·
int aroundindex(int front, int idx){
/* for(int i=0,cnt=0; i<6; i++){
if(front!=i&&otherindex(front)!=i){
if(cnt==idx) return i;
cnt++;
}
}
return 0;*/
int tbl[][] = {
{1, 2, 3, 4},
{0, 2, 3, 5},
{0, 1, 4, 5},
{0, 1, 4, 5},
{0, 2, 3, 5},
{1, 2, 3, 4},
};
return tbl[front][idx];
}
int dindexlist[4];
int uindexlist[4];
int firstindex;
int firstindex2;
bool same(int *arr){
for(int i=0; i<4; i++){
if( otherc(buf[arr[i]][otherindex(dindexlist[i])]) !=
buf[(arr+4)[i]][uindexlist[i]] )
return false;
}
return true;
}
bool check_around2(int *d, int idx, int nest, int *arr){
int c = otherc(buf[*d][idx]);
if( nest == 3 ){
//±êÍÅ̳¢±ëÆêv·é©ð©éàÌÈÌÅÁÊ
for(int around=0; around<4; around++){
int ar = aroundindex(firstindex2,around);
if( c == buf[*(d-3)][ar] ){ //¡Ì¶ª éÆl¦éÌÍÊ|I
//Å̳¢±ëÌãCfbNX
arr[0] = uppderindex( ar, firstindex2 );
return true;
}
}
return false;
}
//̳¢±ë
d++;
for(int i=0; i<6; i++){
if( c == buf[*d][i] ){
for(int around=0; around<4; around++){
int ar = aroundindex(i,around);
//CfbNXÌXg¶áÈĶñɵ½Ù¤ª¢¢©È
arr[nest+1] = uppderindex( i, ar );
if( check_around2(d, ar, nest+1, arr) ){
if( nest == 2 ){
//OóÉÂȪÁÄé̪mèµÄÜ·
if( same(d-7) ) return true;
}else{
return true;
}
}
}
}
}
return false;
}
bool check2(int* d, int* idxlist){
for(int i=0; i<6; i++){ //³¢±ëÌ»ê¼ê̶É¢IJ×é
if( check_around2(d, firstindex2=i, 0, idxlist) ) return true;
}
return false;
}
bool check_around(int *d, int idx, int nest, int *arr){
int c = otherc(buf[*d][idx]);
if( nest == 3 ){
//±êÍÅ̳¢±ëÆêv·é©ð©éàÌÈÌÅÁÊ
for(int around=0; around<4; around++){
int ar = aroundindex(firstindex,around);
if( c == buf[*(d-3)][ar] ){ //¡Ì¶ª éÆl¦éÌÍÊ|I
//Å̳¢±ëÌãCfbNX
arr[0] = uppderindex( ar, firstindex );
return true;
}
}
return false;
}
//̳¢±ë
d++;
for(int i=0; i<6; i++){
if( c == buf[*d][i] ){
for(int around=0; around<4; around++){
int ar = aroundindex(i,around);
//CfbNXÌXg¶áÈĶñɵ½Ù¤ª¢¢©È
arr[nest+1] = uppderindex( i, ar );
if( check_around(d, ar, nest+1, arr) ){
if( nest == 2 ){
//OóÉÂȪÁÄé̪mèµÄÜ·
if( check2( d+1, uindexlist ) ) return true;
}else{
return true;
}
}
}
}
}
return false;
}
bool check(int* d, int* idxlist){
for(int i=0; i<6; i++){ //³¢±ëÌ»ê¼ê̶É¢IJ×é
if( check_around(d, firstindex=i, 0, idxlist) ) return true;
}
return false;
}
bool check_around_pre(int *d, int idx, int nest){
int c = otherc(buf[*d][idx]);
if( nest == 3 ){
//±êÍÅ̳¢±ëÆêv·é©ð©éàÌÈÌÅÁÊ
for(int around=0; around<4; around++){
int ar = aroundindex(firstindex,around);
if( c == buf[*(d-3)][ar] ) return true;
}
return false;
}
//̳¢±ë
d++;
for(int i=0; i<6; i++){
if( c == buf[*d][i] ){
for(int around=0; around<4; around++){
int ar = aroundindex(i,around);
if( check_around_pre(d, ar, nest+1) ) return true;
}
}
}
return false;
}
int cnt;
bool check_pre(int* d){
for(int i=0; i<6; i++){ //³¢±ëÌ»ê¼ê̶É¢IJ×é
if( check_around_pre(d, firstindex=i, 0) ) return true;
}
cnt++;
return false;
}
bool check_pre_2(int* d){
int check=0;
for(int i=0; i<6; i++){
int c0 = otherc(buf[*d][i]);
int c1 = otherc(buf[*(d+6)][i]);
for(int j=0; j<6; j++){
if( buf[*(d+1)][j] == c0 ) check |= 1;
if( buf[*(d+3)][j] == c0 ) check |= 1<<1;
if( buf[*(d+4)][j] == c0 ) check |= 1<<2;
if( buf[*(d+2)][j] == c1 ) check |= 1<<3;
if( buf[*(d+5)][j] == c1 ) check |= 1<<4;
if( buf[*(d+7)][j] == c1 ) check |= 1<<5;
}
}
return check == (1<<6)-1;
}
bool get(){
for(int i=0; i<8; ++i){
std::getline(std::cin,buf[i]);
if(buf[i]=="0")return false;
}
return true;
}
int main(){
while(get()){
int d[8] = {0,1,2,3,4,5,6,7};
do{
//Æè ¦¸2ÂÚÌXgÍìÁÄÌÄçêéñª½·¬éÌÅAæÉ1ÂÅà¶Ý·é©Ç¤©Å}Øè·é
if( check_pre_2(d) && check_pre(d) && check_pre(d+4) && check(d,dindexlist) ){
puts("YES");
goto next;
}
}while(std::next_permutation(d, d+8));
puts("NO");
next:
;
}
} | a.cc: In function 'int aroundindex(int, int)':
a.cc:38:13: error: declaration of 'tbl' as multidimensional array must have bounds for all dimensions except the first
38 | int tbl[][] = {
| ^~~
a.cc:46:16: error: 'tbl' was not declared in this scope
46 | return tbl[front][idx];
| ^~~
|
s217315472 | p00171 | C++ | #include <iostream>
#include <string>
using namespace std;
char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
{1, 5, 2, 3, 0, 4}, {1, 3, 5, 0, 2, 4}, {1, 0, 3, 2, 5, 4}, {1, 2, 0, 5, 3, 4},
{2, 5, 4, 1, 0, 3}, {2, 1, 5, 0, 4, 3}, {2, 0, 1, 4, 5, 3}, {2, 4, 0, 5, 1, 3},
{3, 5, 1, 4, 0, 2}, {3, 4, 5, 0, 1, 2}, {3, 0, 4, 1, 5, 2}, {3, 1, 0, 5, 4, 2},
{4, 5, 3, 2, 0, 1}, {4, 2, 5, 0, 3, 1}, {4, 0, 2, 3, 5, 1}, {4, 3, 0, 5, 2, 1},
{5, 4, 2, 3, 1, 0}, {5, 3, 4, 1, 2, 0}, {5, 1, 3, 2, 4, 0}, {5, 3, 1, 4, 2, 0}};
string dice[8];
bool used[8];
int id[8][3] = {{},
{0},
{0},
{1, 2},
{0},
{1, 4},
{2, 4},
{3, 5, 6}};
int face[8][3] = {{},
{2},
{5},
{5, 2},
{4},
{4, 2},
{4, 0},
{4, 5, 2}};
int size[8] = {0, 1, 1, 2, 1, 2, 2, 3};
pair<int, int> now[8];
bool solve(int pos){
if(pos == 8) return true;
for(int i=0;i<8;i++){
if(used[i]) continue;
used[i] = true;
for(int j=0;j<24;j++){
bool f = true;
for(int k=0;k<size[pos];k++){
int idx = id[pos][k];
int a = dice[now[idx].first][data[now[idx].second][face[pos][k]]];
int b = dice[i][data[j][5-face[pos][k]]];
if(abs(a-b) != (int)('a' - 'A')) f = false;
}
if(!f) continue;
now[pos] = make_pair(i, j);
if(solve(pos+1)) return true;
}
used[i] = false;
}
return false;
}
main(){
while(cin >> dice[0]){
if(dice[0] == "0") break;
for(int i=1;i<8;i++){
cin >> dice[i];
}
fill(used, used+8, false);
cout << (solve(0)?"YES":"NO") << endl;
}
return 0;
} | a.cc: In function 'bool solve(int)':
a.cc:41:21: error: reference to 'size' is ambiguous
41 | for(int k=0;k<size[pos];k++){
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:31:5: note: 'int size [8]'
31 | int size[8] = {0, 1, 1, 2, 1, 2, 2, 3};
| ^~~~
a.cc:43:38: error: reference to 'data' is ambiguous
43 | int a = dice[now[idx].first][data[now[idx].second][face[pos][k]]];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:6: note: 'char data [24][6]'
7 | char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
| ^~~~
a.cc:44:25: error: reference to 'data' is ambiguous
44 | int b = dice[i][data[j][5-face[pos][k]]];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:7:6: note: 'char data [24][6]'
7 | char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
| ^~~~
a.cc: At global scope:
a.cc:56:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
56 | main(){
| ^~~~
|
s985644771 | p00171 | C++ | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
{1, 5, 2, 3, 0, 4}, {1, 3, 5, 0, 2, 4}, {1, 0, 3, 2, 5, 4}, {1, 2, 0, 5, 3, 4},
{2, 5, 4, 1, 0, 3}, {2, 1, 5, 0, 4, 3}, {2, 0, 1, 4, 5, 3}, {2, 4, 0, 5, 1, 3},
{3, 5, 1, 4, 0, 2}, {3, 4, 5, 0, 1, 2}, {3, 0, 4, 1, 5, 2}, {3, 1, 0, 5, 4, 2},
{4, 5, 3, 2, 0, 1}, {4, 2, 5, 0, 3, 1}, {4, 0, 2, 3, 5, 1}, {4, 3, 0, 5, 2, 1},
{5, 4, 2, 3, 1, 0}, {5, 3, 4, 1, 2, 0}, {5, 1, 3, 2, 4, 0}, {5, 3, 1, 4, 2, 0}};
string dice[8];
bool used[8];
int id[8][3] = {{},
{0},
{0},
{1, 2},
{0},
{1, 4},
{2, 4},
{3, 5, 6}};
int face[8][3] = {{},
{2},
{5},
{5, 2},
{4},
{4, 2},
{4, 0},
{4, 5, 2}};
int size[8] = {0, 1, 1, 2, 1, 2, 2, 3};
pair<int, int> now[8];
bool solve(int pos){
if(pos == 8) return true;
for(int i=0;i<8;i++){
if(used[i]) continue;
used[i] = true;
for(int j=0;j<24;j++){
bool f = true;
for(int k=0;k<size[pos];k++){
int idx = id[pos][k];
int a = dice[now[idx].first][data[now[idx].second][face[pos][k]]];
int b = dice[i][data[j][5-face[pos][k]]];
if(abs(a-b) != (int)('a' - 'A')) f = false;
}
if(!f) continue;
now[pos] = make_pair(i, j);
if(solve(pos+1)) return true;
}
used[i] = false;
}
return false;
}
main(){
while(cin >> dice[0]){
if(dice[0] == "0") break;
for(int i=1;i<8;i++){
cin >> dice[i];
}
fill(used, used+8, false);
cout << (solve(0)?"YES":"NO") << endl;
}
return 0;
} | a.cc: In function 'bool solve(int)':
a.cc:42:21: error: reference to 'size' is ambiguous
42 | for(int k=0;k<size[pos];k++){
| ^~~~
In file included from /usr/include/c++/14/string:53,
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/range_access.h:272:5: note: candidates are: 'template<class _Tp, long unsigned int _Nm> constexpr std::size_t std::size(const _Tp (&)[_Nm])'
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:262:5: note: 'template<class _Container> constexpr decltype (__cont.size()) std::size(const _Container&)'
262 | size(const _Container& __cont) noexcept(noexcept(__cont.size()))
| ^~~~
a.cc:32:5: note: 'int size [8]'
32 | int size[8] = {0, 1, 1, 2, 1, 2, 2, 3};
| ^~~~
a.cc:44:38: error: reference to 'data' is ambiguous
44 | int a = dice[now[idx].first][data[now[idx].second][face[pos][k]]];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:8:6: note: 'char data [24][6]'
8 | char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
| ^~~~
a.cc:45:25: error: reference to 'data' is ambiguous
45 | int b = dice[i][data[j][5-face[pos][k]]];
| ^~~~
/usr/include/c++/14/bits/range_access.h:344:5: note: candidates are: 'template<class _Tp> constexpr const _Tp* std::data(initializer_list<_Tp>)'
344 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:334:5: note: 'template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])'
334 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/14/bits/range_access.h:323:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)'
323 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/14/bits/range_access.h:312:5: note: 'template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)'
312 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
a.cc:8:6: note: 'char data [24][6]'
8 | char data[24][6] = {{0, 1, 2, 3, 4, 5}, {0, 3, 1, 4, 2, 5}, {0, 4, 3, 2, 1, 5}, {0, 2, 4, 1, 3, 5},
| ^~~~
a.cc: At global scope:
a.cc:57:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
57 | main(){
| ^~~~
|
s558629654 | p00172 | C | #define M 32768
n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);} | main.c:2:1: warning: data definition has no type or storage class
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:1: error: type defaults to 'int' in declaration of 'n' [-Wimplicit-int]
main.c:2:3: error: type defaults to 'int' in declaration of 'D' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:9: error: type defaults to 'int' in declaration of 'S' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:15: error: type defaults to 'int' in declaration of 'P' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:24: error: type defaults to 'int' in declaration of 'R' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:33: error: type defaults to 'int' in declaration of 'Q' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c:2:41: error: return type defaults to 'int' [-Wimplicit-int]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^
main.c: In function 'E':
main.c:2:41: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:2:41: error: type of 'p' defaults to 'int' [-Wimplicit-int]
main.c:2:41: error: type of 'I' defaults to 'int' [-Wimplicit-int]
main.c:2:110: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'printf'
+++ |+#include <stdio.h>
1 | #define M 32768
main.c:2:110: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,60*M);r<n;r++)for(S[r]=!scanf("%d",&m);m--;S[r]|=1<<--s)scanf("%d",&s);I[*P]=-1;I[*R]=*S;n--;for(q=I;I&&!P[n][1<<n];I=Q[p*M+I]){p=I/M,I%=M;for(s=R[p][I];r=-s&s;J&1<<p&&!P[p][J]?q=Q[P[p][J]=p*M+I,R[p][J]=s,q]=p*M+J:0)J=I^r,s^=r;for(r=n+1;r--;)I&D[p]&1<<r&&!P[r][I]?q=Q[P[r][I]=p*M+I,R[r][I]=S[r],e|=r==n,q]=r*M+I:0;}}exit(0);}
| ^~~~~~
main.c:2:110: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:2:224: error: implicit declaration of function 'elseprintf' [-Wimplicit-function-declaration]
2 | n,D[15],S[15],P[15][M],R[15][M],Q[15*M];E(c,p,I){int r,s,J;if(~P[p][I]){if(r=P[p][I],E(c+1,s=r/M,J=r%M),s-p&&printf("Move to room %d.\n",p+1),J-I){for(r=0;J^I^1<<r;r++);printf("Switch o%s room %d.\n",I&1<<r?"n":"ff",r+1);}}elseprintf("You can go home in %d steps.\n",c);}J,q,m,s,r,e;main(p,I){for(;scanf("%d%d",&n,&m),n;P[n][1<<n]?E(0,n,1<<n):puts(e?"You can not switch off all lights.":"Help me!")){for(memset(D,e=0,60);m--;D[--r]|=1<<--s,D[s]|=1<<r)scanf("%d%d",&r,&s);for(memset(P,I=r=0,60*M);r<n;I|=s<<r++)scanf("%d",&s);for(memset(Q,r=0,6 |
s223844938 | p00172 | C++ | import std.stdio;
import std.c.stdio;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;
int lsb(int x) {
int c = 0;
while (x > 0) {
x >>= 1;
c++;
}
return c;
}
int popcount(int x) {
int c = 0;
while (x > 0) {
if (x & 1) c++;
x >>= 1;
}
return c;
}
void main() {
int N, M;
int[][] G;
int[][] S;
int init;
bool input() {
scanf("%d %d\n", &N, &M);
if (N == 0 && M == 0) return false;
G = new int[][N];
S = new int[][N];
foreach (i; 0 .. M) {
int s, t; scanf("%d %d\n", &s, &t);
s--; t--;
G[s] ~= t;
G[t] ~= s;
}
foreach (i; 0 .. N) {
G[i] = G[i].sort;
}
init = 0;
foreach (i; 0 .. N) {
int s; scanf("%d", &s);
init |= (s << i);
}
foreach (i; 0 .. N) {
int k; scanf("%d\n", &k);
foreach (j; 0 .. k) {
int r; scanf("%d", &r);
r--;
S[i] ~= r;
}
S[i] = S[i].sort;
}
return true;
}
void solve() {
if (! (init & 1)) {
writeln("Help me!");
return;
}
struct P {
int v, bit;
}
const X = P(-1, -1);
auto prev = new P[][](N, 1 << N);
bool bfs() {
foreach (i; 0 .. N) prev[i][] = X;
DList!P Q;
Q.insert(P(0, init));
while (!Q.empty) {
P p = Q.front; Q.removeFront;
if (p.v == N - 1 && p.bit == (1 << (N - 1))) {
return true;
}
foreach (v; S[p.v]) {
int bit;
if (p.bit & (1 << v)) {
bit = p.bit - (1 << v);
} else {
bit = p.bit + (1 << v);
}
if (prev[p.v][bit] != X) continue;
prev[p.v][bit] = p;
Q.insert(P(p.v, bit));
}
foreach (v; G[p.v]) {
if (prev[v][p.bit] != X) continue;
if (p.bit & (1 << v)) {
prev[v][p.bit] = p;
Q.insert(P(v, p.bit));
}
}
}
return false;
}
if (bfs) {
int v = N - 1, bit = 1 << (N - 1);
string[] path;
while (v != 0 || bit != init) {
int v1 = prev[v][bit].v;
int bit1 = prev[v][bit].bit;
if (v == v1) {
assert(popcount(bit ^ bit1) == 1);
string fstr = "Switch " ~ (bit > bit1 ? "on" : "off") ~ " room %d.";
path ~= format(fstr, lsb(bit ^ prev[v][bit].bit));
} else {
path ~= format("Move to room %d.", v + 1);
}
//writefln("%d %b -> %d %b", v1, bit1, v, bit);
v = v1;
bit = bit1;
}
writefln("You can go home in %d steps.", path.length);
path.reverse;
foreach (p; path) {
writeln(p);
}
} else {
bool r() {
foreach (i; 0 .. (1 << N)) {
if (prev[N - 1][i] != X) {
return true;
}
}
return false;
}
writeln( r ? "You can not switch off all lights." : "Help me!" );
}
}
while (input) {
solve;
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import std.stdio;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import std.c.stdio;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import std.range;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import std.array;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import std.functional;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import std.algorithm;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import std.conv;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import std.container;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import std.math;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import std.numeric;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import std.string;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:1: error: 'import' does not name a type
12 | import std.c.string;
| ^~~~~~
a.cc:12:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:13:1: error: 'import' does not name a type
13 | import std.regex;
| ^~~~~~
a.cc:13:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:14:1: error: 'import' does not name a type
14 | import std.typecons;
| ^~~~~~
a.cc:14:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:34:1: error: '::main' must return 'int'
34 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:36:8: error: structured binding declaration cannot have type 'int'
36 | int[][] G;
| ^~
a.cc:36:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:36:8: error: empty structured binding declaration
a.cc:36:10: error: expected initializer before '[' token
36 | int[][] G;
| ^
a.cc:37:8: error: structured binding declaration cannot have type 'int'
37 | int[][] S;
| ^~
a.cc:37:8: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:37:8: error: empty structured binding declaration
a.cc:37:10: error: expected initializer before '[' token
37 | int[][] S;
| ^
a.cc:40:15: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
40 | bool input() {
| ^~
a.cc:40:15: note: remove parentheses to default-initialize a variable
40 | bool input() {
| ^~
| --
a.cc:40:15: note: or replace parentheses with braces to value-initialize a variable
a.cc:40:18: error: a function-definition is not allowed here before '{' token
40 | bool input() {
| ^
a.cc:71:18: error: a function-definition is not allowed here before '{' token
71 | void solve() {
| ^
a.cc:146:12: error: 'input' was not declared in this scope
146 | while (input) {
| ^~~~~
a.cc:147:9: error: 'solve' was not declared in this scope
147 | solve;
| ^~~~~
|
s037316158 | p00172 | C++ | // AOJ 0172: Doctor's Research Rooms
// 2018.1.24 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MOVE 0x40
#define ON 0x50
#define OFF 0x60
#define QMAX 300000
typedef struct { char rm; int light; char step, act[50]; } Q;
Q q[QMAX+2]; int top, end;
int rm[15][15], s_rm[15];
int sw[15][15], s_sw[15];
char mk[15][33000];
char *msg[7] = {0,
"You can go home in %d steps.\n",
"You can not switch off all lights.",
"Help me!",
"Move to room %d.\n",
"Switch on room %d.\n",
"Switch off room %d.\n" };
//#define getchar_unlocked() getchar()
int in()
{
int n = 0;
int c = getchar_unlocked();
while (c < '0') c = getchar_unlocked();
do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
while (c >= '0');
return n;
}
int cmp(int *a, int *b) { return *a - *b; }
int main()
{
int n, m, i, j, s, t, ans;
int light;
Q p, np;
while (n = in()) {
m = in();
memset(s_rm, 0, sizeof(s_rm));
memset(s_sw, 0, sizeof(s_sw));
for (i = 0; i < m; i++){
s = in()-1, t = in()-1;
rm[s][s_rm[s]++] = t;
rm[t][s_rm[t]++] = s;
}
light = 0; for (i = 0; i < n; i++) if (in()) light |= 1 << i;
for (i = 0; i < n; i++) {
j = in(); while (j--) sw[i][s_sw[i]++] = in()-1;
qsort(sw[i], s_sw[i], sizeof(int), cmp);
}
memset(mk, 0, sizeof(mk));
q[0].rm = 0, q[0].light = light, q[0].step = 0;
top = 0, end = 1;
ans = 3;
while (top != end) {
p = q[top]; if (++top == QMAX) top = 0;
s = p.rm, t = p.light;
if (mk[s][t]) continue;
mk[s][t] = 1;
if (s == n-1) {
if (t == 1<<(n-1)) { ans = 1; break; }
ans = 2;
}
for (i = 0; i < s_sw[s]; i++) if (sw[s][i] != s) {
j = t ^ (1<<sw[s][i]);
np = p, np.light = j;
if (t & (1<<sw[s][i])) np.act[np.step] = OFF | sw[s][i];
else np.act[np.step] = ON | sw[s][i];
np.step++;
q[end] = np; if (++end == QMAX) end = 0;
}
for (i = 0; i < s_rm[s]; i++) if (t & (1<<rm[s][i])) {
np = p, np.rm = rm[s][i];
np.act[np.step++] = MOVE | rm[s][i];
q[end] = np; if (++end == QMAX) end = 0;
}
}
if (ans > 1) puts(msg[ans]);
else {
printf(msg[ans], p.step);
for (i = 0; i < p.step; i++) printf(msg[p.act[i] >> 4], 1+(p.act[i] & 0xf));
}
}
return 0;
}
| a.cc:21:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
21 | "You can go home in %d steps.\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:22:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
22 | "You can not switch off all lights.",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:23:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
23 | "Help me!",
| ^~~~~~~~~~
a.cc:24:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
24 | "Move to room %d.\n",
| ^~~~~~~~~~~~~~~~~~~~
a.cc:25:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
25 | "Switch on room %d.\n",
| ^~~~~~~~~~~~~~~~~~~~~~
a.cc:26:1: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
26 | "Switch off room %d.\n" };
| ^~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:62:60: error: invalid conversion from 'int (*)(int*, int*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
62 | qsort(sw[i], s_sw[i], sizeof(int), cmp);
| ^~~
| |
| int (*)(int*, int*)
In file included from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/stdlib.h:36,
from a.cc:5:
/usr/include/stdlib.h:971:34: note: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s411466501 | p00172 | C++ | #include<iostream>
#include<vector>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define foreach(i,c) for(__typeof(c.begin()) i=c.begin();i!=c.end();i++)
#define mp make_pair
using namespace std;
typedef vector<int> vi;
int main(){
int m,n,t,u;
while(cin>>n>>m,n){
vector<vi> dr(n,n),sw(n);
rep(i,m)cin>>t>>u,t--,u--,dr[t][u]=dr[u][t]=1;
vi li(n); rep(i,n)cin>>li[i];
rep(i,n){
cin>>t;
rep(j,t)cin>>u,sw[i].push_back(--u);
}
map<vi,vi> frontier,visited;
vi st(n),phi(0); st=li,st.push_back(0);
frontier.insert(mp(st,phi)); visited.insert(mp(st,phi));
int finished=0,goaled=0,cleared=0;
vi goal(n+1); goal[n-1]=1; goal[n]=n-1;
while(!finished&&!frontier.empty()){
finished=1;
foreach(i,frontier){
vi cstate,cstep,nstate,nstep;
cstate=i->first,cstep=i->second;
int crm=cstate[n];
rep(j,n){
if(dr[crm][j]&&cstate[j]&&crm!=j){
nstate=cstate; nstate[n]=j;
nstep=cstep; nstep.push_back(j);
if(visited.find(nstate)!=visited.end())continue;
frontier.insert(mp(nstate,nstep));
visited.insert(mp(nstate,nstep));
if(nstate[n]==n-1)goaled=1;
if(nstate==goal)cleared=finished=1;
finished=0; goto NEXT;
}
}
rep(j,sw[crm].size()){
nstate=cstate; nstep=cstep;
t=sw[crm][j]; u=nstate[t];
nstate[t]^=1;
nstep.push_back(100*(u+1)+t);
if(visited.find(nstate)!=visited.end())continue;
frontier.insert(mp(nstate,nstep));
visited.insert(mp(nstate,nstep));
if(nstate[n]==n-1)goaled=1;
if(nstate==goal)cleared=finished=1;
finished=0; goto NEXT;
}
frontier.erase(i); finished=0; goto NEXT;
}
NEXT:;
}
if(cleared){
vi step=visited[goal];
vi ans;
rep(i,step.size()){
map<int,int> ssw;
while(i<step.size()&&step[i]>99){
if(ssw.find(step[i]%100)==ssw.end())ssw[step[i]%100]=step[i];
else ssw.erase(ssw.find(step[i]%100));
i++;
}
foreach(j,ssw)ans.push_back(j->second);
ssw.clear();
if(i<step.size())ans.push_back(step[i]);
}
cout<<"You can go home in "<<ans.size()<<" steps."<<endl;
rep(i,ans.size()){
if(ans[i]<100)cout<<"Move to";
else cout<<"Switch "<<(ans[i]<200?"on":"off");
cout<<" room "<<ans[i]%100+1<<"."<<endl;
}
}else cout<<(goaled?"You can not switch off all lights.":"Help me!")<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:34: error: no matching function for call to 'std::vector<std::vector<int> >::vector(int&, int&)'
12 | vector<vi> dr(n,n),sw(n);
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
from /usr/include/c++/14/string:47,
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_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]':
/usr/include/c++/14/bits/stl_vector.h:705:9: required from here
705 | typename = std::_RequireInputIter<_InputIterator>>
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
252 | input_iterator_tag>::value>;
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<int> >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<int> >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<int> >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<int> >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; value_type = std::vector<int>; allocator_type = std::allocator<std::vector<int> >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::value_type&' {aka 'const std::vector<int>&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<int> >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<int> >::allocator_type&' {aka 'const std::allocator<std::vector<int> >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; allocator_type = std::allocator<std::vector<int> >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s810958807 | p00172 | C++ | include <iostream>
#include <stdlib.h>
#include <stack>
using namespace std;
int r[1050000],rp[2][1050000],sw[2][1050000],rb[2],bf;
int main() {
int a,i,j,k,g,m,n,s,t,f,f2,rl[16][16],rs[16][16],sn[16],lc[16],p=65536;
stack<int> an,bn;
while(cin >> n >> m) {
if (n==0) break;
for (i=0;i<1050000;i++) r[i]=-1;
for (i=0;i<16;i++) sn[i]=lc[i]=0;
for (i=0;i<m;i++) { cin >> s >> t; rl[s-1][lc[s-1]++]=t-1; rl[t-1][lc[t-1]++]=s-1; }
rb[0]=1; f=0; bf=0; sw[0][0]=0;
for (i=0;i<n;i++) { cin >> j; f+=(1 << i)*j; }
r[f]=0; rp[0][0]=f;
for (i=0;i<n;i++) {
cin >> k; sn[i]=0;
if (k>0) for (j=0;j<k;j++) {cin >> rs[i][sn[i]++]; rs[i][sn[i]-1]--;}
for (j=sn[i]-1;j>0;j--) for (k=0;k<j;k++)
if (rs[i][k]>rs[i][k+1]) { a=rs[i][k]; rs[i][k]=rs[i][k+1]; rs[i][k+1]=a;}
}
f2=f=0;
while(f==0) {
f=1; rb[1-bf]=0;
for (i=0;i<rb[bf];i++) {
s=rp[bf][i]/p; t=(p-1) & rp[bf][i];
if (s==n-1) f2=1;
for (g=0;g<lc[s];g++) {
if ((t & (1 << rl[s][g]))>0 && r[rl[s][g]*p+t]==-1) {
f=0;
r[rl[s][g]*p+t]=s*p+t;
sw[1-bf][rb[1-bf]]=0;
rp[1-bf][rb[1-bf]++]=rl[s][g]*p+t;
}
}
if (sn[s]==0) continue;
for (k=sw[bf][i];k<sn[s];k++) {
a=rp[bf][i] ^ (1 << rs[s][k]);
if (r[a]==-1) { f=0; r[a]=rp[bf][i]; sw[1-bf][rb[1-bf]]=k+1; rp[1-bf][rb[1-bf]++]=a;}
}
}
bf=1-bf;
}
s=(n-1)*p+(1 << (n-1));
if (f2==0) { cout << "Help me!"<< endl; continue;}
if (r[s]==-1) { cout << "You can not switch off all light." << endl; continue;}
while (r[s]!=0) {
if (s/p!=r[s]/p) { an.push(s/p); bn.push(0);} else {
for (k=0;k<15;k++) {
if ((s & (1 << k))>0 && (r[s] & (1 << k))==0) { an.push(k); bn.push(1);}
if ((s & (1 << k))==0 && (r[s] & (1 << k))>0) { an.push(k); bn.push(2);}
}
}
s=r[s];
}
cout << "You can go home in " << an.size() << " steps." << endl;
while(!an.empty()) {
if (bn.top()==0) cout << "Move to room ";
if (bn.top()==1) cout << "Switch on room ";
if (bn.top()==2) cout << "Switch off room ";
cout << an.top()+1 << '.' << endl;
an.pop(); bn.pop();
}
}
return 0;
} | 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/deque:62,
from /usr/include/c++/14/stack:62,
from a.cc:3:
/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'
164 | __is_null_pointer(std::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'
666 | struct is_null_pointer<std::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)>
| ^~~~~~
In file included from /usr/include/stdlib.h:32,
from /usr/include/c++/14/cstdlib:79,
from /usr/include/c++/14/stdlib.h:36,
from a.cc:2:
/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_algobase.h:65:
/usr/include/c++/14/bits/stl_iterator_base_types.h:125:67: error: 'ptrdiff_t' does not name a type
125 | template<typename _Category, typename _Tp, typename _Distance = ptrdiff_t,
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:1:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
+++ |+#include <cstddef>
1 | // Types used in iterator implementation -*- C++ -*-
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: error: 'ptrdiff_t' does not name a type
214 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:214:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: error: 'ptrdiff_t' does not name a type
225 | typedef ptrdiff_t difference_type;
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:225:15: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_algobase.h:66:
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:112:5: error: 'ptrdiff_t' does not name a type
112 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:66:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
65 | #include <debug/assertions.h>
+++ |+#include <cstddef>
66 | #include <bits/stl_iterator_base_types.h>
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: error: 'ptrdiff_t' does not name a type
118 | ptrdiff_t
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_funcs.h:118:5: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
In file included from /usr/include/c++/14/bits/stl_iterator.h:67,
from /usr/include/c++/14/bits/stl_algobase. |
s893463719 | p00173 | Java | import java.util.Scanner;
class Main {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
String str;
int am, pm;
for(int i = 0; i < 9; i++){
str = scan.next();
am = scan.nextInt();
pm = scan.nextInt();
System.out.println(str + " " + am + pm + " " + am * 200 + pm * 300);
} | Main.java:15: error: reached end of file while parsing
}
^
1 error
|
s909165304 | p00173 | Java | import java.util.*;
public class HauntedHouse {
static Scanner sc = new Scanner(System.in);
static String[] name = new String[9];
static int[][] Array = new int[9][2];
public static void main(String[] args) {
for(int i = 0; i < 9; i++){
read();
slove();
}
}
static boolean read(){
String line;
String[] devide = new String[3];
for(int i = 0; i < 9; i++){
line = sc.nextLine();
devide = line.split(" ");
name[i] = devide[0];
Array[i][0] = Integer.parseInt(devide[1])
+Integer.parseInt(devide[2]);
Array[i][1] = Integer.parseInt(devide[1])*200
+Integer.parseInt(devide[2])*300;
}
return true;
}
static void slove(){
for(int i = 0; i < 9; i++){
System.out.print(name[i] + " ");
System.out.print(Array[i][0] + " ");
System.out.println(Array[i][1]);
}
}
} | Main.java:2: error: class HauntedHouse is public, should be declared in a file named HauntedHouse.java
public class HauntedHouse {
^
1 error
|
s718102021 | p00173 | Java | import java.util.*;
public class HauntedHouse {
static Scanner sc = new Scanner(System.in);
static String[] name = new String[9];
static int[][] Array = new int[9][2];
public static void main(String[] args) {
for(int i = 0; i < 9; i++){
read();
slove();
}
}
static boolean read(){
String line;
String[] devide = new String[3];
for(int i = 0; i < 9; i++){
line = sc.nextLine();
devide = line.split(" ");
name[i] = devide[0];
Array[i][0] = Integer.parseInt(devide[1])
+Integer.parseInt(devide[2]);
Array[i][1] = Integer.parseInt(devide[1])*200
+Integer.parseInt(devide[2])*300;
}
return true;
}
static void slove(){
for(int i = 0; i < 9; i++){
System.out.print(name[i] + " ");
System.out.print(Array[i][0] + " ");
System.out.println(Array[i][1]);
}
}
} | Main.java:2: error: class HauntedHouse is public, should be declared in a file named HauntedHouse.java
public class HauntedHouse {
^
1 error
|
s898759674 | p00173 | Java | import java.util.*;
public class aoj0173 {
static final Scanner stdin = new Scanner(System.in);
public static void main(String[] args) {
int i = 9;
while(i-- > 0){
String s = stdin.next();
int a = stdin.nextInt(), b = stdin.nextInt();
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
}
}
} | Main.java:2: error: class aoj0173 is public, should be declared in a file named aoj0173.java
public class aoj0173 {
^
1 error
|
s873402336 | p00173 | Java | import java.util.*;
public Main {
public static void main(String[] args) {
static Scanner stdin = new Scanner(System.in);
int i = 9;
while(i-- > 0){
String s = stdin.next();
int a = stdin.nextInt(), b = stdin.nextInt();
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
}
}
} | Main.java:2: error: class, interface, enum, or record expected
public Main {
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
Main.java:4: error: illegal start of expression
static Scanner stdin = new Scanner(System.in);
^
Main.java:6: error: class, interface, enum, or record expected
while(i-- > 0){
^
Main.java:9: error: class, interface, enum, or record expected
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
^
Main.java:10: error: class, interface, enum, or record expected
}
^
6 errors
|
s447514821 | p00173 | Java | import java.util.*;
public Main {
public static void main(String[] args) {
static final Scanner stdin = new Scanner(System.in);
int i = 9;
while(i-- > 0){
String s = stdin.next();
int a = stdin.nextInt(), b = stdin.nextInt();
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
}
}
} | Main.java:2: error: class, interface, enum, or record expected
public Main {
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
public static void main(String[] args) {
^
(use --enable-preview to enable unnamed classes)
Main.java:4: error: illegal start of expression
static final Scanner stdin = new Scanner(System.in);
^
Main.java:6: error: class, interface, enum, or record expected
while(i-- > 0){
^
Main.java:9: error: class, interface, enum, or record expected
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
^
Main.java:10: error: class, interface, enum, or record expected
}
^
6 errors
|
s908088232 | p00173 | Java | import java.util.*;
public Main {
static final Scanner stdin = new Scanner(System.in);
public static void main(String[] args) {
int i = 9;
while(i-- > 0){
String s = stdin.next();
int a = stdin.nextInt(), b = stdin.nextInt();
System.out.println(s + " " + (a+b) + " " + (200*a+300*b));
}
}
} | Main.java:2: error: class, interface, enum, or record expected
public Main {
^
Main.java:3: error: unnamed classes are a preview feature and are disabled by default.
static final Scanner stdin = new Scanner(System.in);
^
(use --enable-preview to enable unnamed classes)
Main.java:12: error: class, interface, enum, or record expected
}
^
3 errors
|
s434253617 | p00173 | C | #include<stdio.h>
int main(void){
char c[8][1];
int a[8] ={0},b[8] = {0},i;
for(i=0;i<8;i++){
scanf("%d%d %d %d",&c[i][0],&c[i][1],&a[i],&b[i]);
}
for(i=0;i<8;i++){
printf("%d%d %d %d\n",c[i][0],c[i]c[1],a[i]+b[i],a[i]*200+b[i]*300);
}
} | main.c: In function 'main':
main.c:9:51: error: expected ')' before 'c'
9 | printf("%d%d %d %d\n",c[i][0],c[i]c[1],a[i]+b[i],a[i]*200+b[i]*300);
| ~ ^
| )
|
s839645838 | p00173 | C | #include<stdio.h>
int main(void){
char c[8][1];
int a[8] ={0},b[8] = {0},i;
for(i=0;i<8;i++){
scanf("%s%s %d %d",&c[i][0],&c[i][1],&a[i],&b[i]);
}
for(i=0;i<8;i++){
printf("%s%s %d %d\n",c[i][0],c[i]c[1],a[i]+b[i],a[i]*200+b[i]*300);
}
} | main.c: In function 'main':
main.c:9:51: error: expected ')' before 'c'
9 | printf("%s%s %d %d\n",c[i][0],c[i]c[1],a[i]+b[i],a[i]*200+b[i]*300);
| ~ ^
| )
|
s103073387 | p00173 | C | #include <stdio.h>
#include <string.h>
int main(void) {
int i,m,n,l,k;
char str[200],s[5];
for( ;fgets(str,sizeof(str),stdin)!=NULL;){
sscanf(str,"%s %d %d",&s,&n,&m);
l=n+m; k=n*200+m*300
printf("%s %d %d\n",&s,l,k);
}
return 0;
} | main.c: In function 'main':
main.c:10:37: error: expected ';' before 'printf'
10 | l=n+m; k=n*200+m*300
| ^
| ;
11 | printf("%s %d %d\n",&s,l,k);
| ~~~~~~
|
s798783525 | p00173 | C | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));} | main.c:1:1: error: return type defaults to 'int' [-Wimplicit-int]
1 | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));}
| ^~~~
main.c: In function 'main':
main.c:1:32: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));}
main.c:1:32: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));}
| ^~~~~
main.c:1:32: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:56: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | main(){char s[20];for(int a,b;~scanf("%s%d%d",s,&a,&b);printf("%s %d %d\n",s,a+b,a*200+b*300));}
| ^~~~~~
main.c:1:56: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:56: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:56: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s900619265 | p00173 | C | #include<stdio.h>
int main(){
int i;
char str[15];
int am;
int pm;
for(i = 0; i < 9; i++){
scanf("%s", str);
scanf("%d", &am);
scanf("%d", &pm);
printf("%s %d %d\n", str, am + pm, a * 200 + a * 300);
}
return 0;
} | main.c: In function 'main':
main.c:12:52: error: 'a' undeclared (first use in this function); did you mean 'am'?
12 | printf("%s %d %d\n", str, am + pm, a * 200 + a * 300);
| ^
| am
main.c:12:52: note: each undeclared identifier is reported only once for each function it appears in
|
s126480676 | p00173 | C | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;} | main.c:1:1: warning: data definition has no type or storage class
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'a' defaults to 'int' [-Wimplicit-int]
main.c:1:7: error: type of 'b' defaults to 'int' [-Wimplicit-int]
main.c:1:32: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
main.c:1:32: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~
main.c:1:32: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:66: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | d=400;main(a,b){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~~
main.c:1:66: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:66: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:66: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s714800394 | p00173 | C | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;} | main.c:1:1: warning: data definition has no type or storage class
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:11: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~
main.c: In function 'main':
main.c:1:33: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
main.c:1:33: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~
main.c:1:33: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:67: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a,b,d=400;main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~~
main.c:1:67: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:67: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:67: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s207532121 | p00173 | C | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;} | main.c:1:1: warning: data definition has no type or storage class
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:16: error: variably modified 'c' at file scope
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^
main.c:1:21: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~
main.c: In function 'main':
main.c:1:34: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
main.c:1:34: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~
main.c:1:34: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:68: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a,b,d=400;char c[d];main(){for(;~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d00\n",c,a+b,a*2+b*3))b=b/d?d:b;}
| ^~~~~~
main.c:1:68: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:68: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:68: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s573274932 | p00173 | C++ | using System;
class main {
public static void Main(string[] args) {
for(int i=0; i<9; i++) {
var input = Console.ReadLine().Split();
int a = int.Parse(input[1]);
int b = int.Parse(input[2]);
Console.WriteLine("{0} {1} {2}", input[0], a+b, a*200+b*300);
}
}
} | a.cc:1:7: error: expected nested-name-specifier before 'System'
1 | using System;
| ^~~~~~
a.cc:4:15: error: expected ':' before 'static'
4 | public static void Main(string[] args) {
| ^~~~~~~
| :
a.cc:4:33: error: 'string' has not been declared
4 | public static void Main(string[] args) {
| ^~~~~~
a.cc:4:42: error: expected ',' or '...' before 'args'
4 | public static void Main(string[] args) {
| ^~~~
a.cc:12:2: error: expected ';' after class definition
12 | }
| ^
| ;
a.cc: In static member function 'static void main::Main(int*)':
a.cc:6:25: error: 'var' was not declared in this scope
6 | var input = Console.ReadLine().Split();
| ^~~
a.cc:7:33: error: expected primary-expression before 'int'
7 | int a = int.Parse(input[1]);
| ^~~
a.cc:8:33: error: expected primary-expression before 'int'
8 | int b = int.Parse(input[2]);
| ^~~
a.cc:9:25: error: 'Console' was not declared in this scope
9 | Console.WriteLine("{0} {1} {2}", input[0], a+b, a*200+b*300);
| ^~~~~~~
a.cc:9:58: error: 'input' was not declared in this scope; did you mean 'int'?
9 | Console.WriteLine("{0} {1} {2}", input[0], a+b, a*200+b*300);
| ^~~~~
| int
|
s125792103 | p00173 | C++ | 1a 132 243
1c 324 183
1f 93 199
2b 372 163
2c 229 293
2e 391 206
3a 118 168
3b 263 293
3d 281 102 | a.cc:6:1: error: exponent has no digits
6 | 2e 391 206
| ^~
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1a 132 243
| ^~
|
s645787917 | p00173 | C++ | #include <iostream>
#include <string>
#define N 9
using namespace std;
int main() {
string name;
int a, b;
while (N--) {
int am = 200, pm = 300;
cin >> name >> a >> b;
int num = a+b;
int fee = a*am+b*pm;
cout << name << " " << num << " " << fee << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:3:11: error: lvalue required as decrement operand
3 | #define N 9
| ^
a.cc:9:10: note: in expansion of macro 'N'
9 | while (N--) {
| ^
|
s577138022 | p00173 | C++ | #include<iostream>
#include<string>
using namespace std;
int main(){
string a[9];
int b[9];
int c[9];
for (int i = 0; i < 9; i++){
cin >> a[i] >> b[i] >> c[i];
}
for (int i = 0; i < 9; i++){
cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:22: error: no match for 'operator>>' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ~~~~ ^~ ~~~~
| | |
| | std::string {aka std::__cxx11::basic_string<char>}
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/string:55,
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.tcc:835:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
835 | operator>>(basic_istream<_CharT, _Traits>& __in,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.tcc:835:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:38,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/cstddef:131:5: note: candidate: 'template<class _IntegerType> constexpr std::__byte_op_t<_IntegerType> std::operator>>(byte, _IntegerType)'
131 | operator>>(byte __b, _IntegerType __shift) noexcept
| ^~~~~~~~
/usr/include/c++/14/cstddef:131:5: note: template argument deduction/substitution failed:
a.cc:12:17: note: cannot convert 'std::cout' (type 'std::ostream' {aka 'std::basic_ostream<char>'}) to type 'std::byte'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^~~~
In file included from /usr/include/c++/14/istream:1109,
from /usr/include/c++/14/iostream:42:
/usr/include/c++/14/bits/istream.tcc:978:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT&)'
978 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT& __c)
| ^~~~~~~~
/usr/include/c++/14/bits/istream.tcc:978:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:849:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char&)'
849 | operator>>(basic_istream<char, _Traits>& __in, unsigned char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:849:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:854:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char&)'
854 | operator>>(basic_istream<char, _Traits>& __in, signed char& __c)
| ^~~~~~~~
/usr/include/c++/14/istream:854:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:896:5: note: candidate: 'template<class _CharT, class _Traits> std::basic_istream<_CharT, _Traits>& std::operator>>(basic_istream<_CharT, _Traits>&, _CharT*)'
896 | operator>>(basic_istream<_CharT, _Traits>& __in, _CharT* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:896:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<_CharT, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:939:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, unsigned char*)'
939 | operator>>(basic_istream<char, _Traits>& __in, unsigned char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:939:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:945:5: note: candidate: 'template<class _Traits> std::basic_istream<char, _Traits>& std::operator>>(basic_istream<char, _Traits>&, signed char*)'
945 | operator>>(basic_istream<char, _Traits>& __in, signed char* __s)
| ^~~~~~~~
/usr/include/c++/14/istream:945:5: note: template argument deduction/substitution failed:
a.cc:12:28: note: 'std::ostream' {aka 'std::basic_ostream<char>'} is not derived from 'std::basic_istream<char, _Traits>'
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:1099:5: note: candidate: 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&)'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
/usr/include/c++/14/istream:1099:5: note: template argument deduction/substitution failed:
/usr/include/c++/14/istream: In substitution of 'template<class _Istream, class _Tp> _Istream&& std::operator>>(_Istream&&, _Tp&&) [with _Istream = std::basic_ostream<char>&; _Tp = std::__cxx11::basic_string<char>&]':
a.cc:12:14: required from here
12 | cout >> a[i] >>" ">> b[i] + c[i] >>" ">> b[i] * 200 + c[i] * 200 << endl;
| ^
/usr/include/c++/14/istream:1099:5: error: no type named 'type' in 'struct std::enable_if<false, void>'
1099 | operator>>(_Istream&& __is, _Tp&& __x)
| ^~~~~~~~
|
s630340155 | p00173 | C++ | 1a 132 243
1c 324 183
1f 93 199
2b 372 163
2c 229 293
2e 391 206
3a 118 168
3b 263 293
3d 281 102 | a.cc:6:1: error: exponent has no digits
6 | 2e 391 206
| ^~
a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 1a 132 243
| ^~
|
s362819953 | p00173 | C++ | using namespace std;
int main(int argc, char const* argv[])
{
string name;
int a,b;
for( int i = 0;i < 9;i++ ){
cin >> name >> a >> b;
cout << name << " " << a + b << " " << a * 200 + b * 300 << endl;
}
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:5:9: error: 'string' was not declared in this scope
5 | string name;
| ^~~~~~
a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
+++ |+#include <string>
1 | using namespace std;
a.cc:9:17: error: 'cin' was not declared in this scope
9 | cin >> name >> a >> b;
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | using namespace std;
a.cc:9:24: error: 'name' was not declared in this scope
9 | cin >> name >> a >> b;
| ^~~~
a.cc:10:17: error: 'cout' was not declared in this scope
10 | cout << name << " " << a + b << " " << a * 200 + b * 300 << endl;
| ^~~~
a.cc:10:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:10:77: error: 'endl' was not declared in this scope
10 | cout << name << " " << a + b << " " << a * 200 + b * 300 << endl;
| ^~~~
a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
+++ |+#include <ostream>
1 | using namespace std;
|
s558841605 | p00173 | C++ | #include <stdio.h>
int main(void) {
int am,pm;
char class[20];
while(scanf("%s %d %d",class,&am,&pm)!=EOF) {
printf("%s %d %d\n",class,am+pm,am*200+pm*300);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:3: error: two or more data types in declaration of 'structured binding'
6 | char class[20];
| ^~~~
a.cc:6:13: error: empty structured binding declaration
6 | char class[20];
| ^
a.cc:6:3: error: expected primary-expression before 'char'
6 | char class[20];
| ^~~~
a.cc:9:26: error: expected primary-expression before 'class'
9 | while(scanf("%s %d %d",class,&am,&pm)!=EOF) {
| ^~~~~
a.cc:11:25: error: expected primary-expression before 'class'
11 | printf("%s %d %d\n",class,am+pm,am*200+pm*300);
| ^~~~~
|
s747874534 | p00173 | C++ | #include <stdio.h>
int main(void) {
int am,pm;
char class[20];
int i;
for(i=0;i<9;i++) {
scanf("%s %d %d",class,&am,&pm);
printf("%s %d %d\n",class,am+pm,am*200+pm*300);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:3: error: two or more data types in declaration of 'structured binding'
6 | char class[20];
| ^~~~
a.cc:6:13: error: empty structured binding declaration
6 | char class[20];
| ^
a.cc:6:3: error: expected primary-expression before 'char'
6 | char class[20];
| ^~~~
a.cc:13:22: error: expected primary-expression before 'class'
13 | scanf("%s %d %d",class,&am,&pm);
| ^~~~~
a.cc:15:25: error: expected primary-expression before 'class'
15 | printf("%s %d %d\n",class,am+pm,am*200+pm*300);
| ^~~~~
|
s182828643 | p00173 | C++ | include<cstdio>
int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;} | a.cc:1:1: error: 'include' does not name a type
1 | include<cstdio>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:2:37: error: 'd' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:56: error: 'c' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:59: error: 'a' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:62: error: 'b' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:41: error: 'scanf' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~
a.cc:2:75: error: 'printf' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | include<cstdio>
|
s973309598 | p00173 | C++ | include<cstdio>
int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;} | a.cc:1:1: error: 'include' does not name a type
1 | include<cstdio>
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:2:37: error: 'd' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:56: error: 'c' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:59: error: 'a' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:62: error: 'b' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^
a.cc:2:41: error: 'scanf' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~
a.cc:2:75: error: 'printf' was not declared in this scope
2 | int a,b,d=400;int main(){for(char c[d];~scanf("%s%d%d",c,&a,&b);a=a/d?d:a,printf("%s %d %d\n",c,a+b,a*200+b*300))b=b/d?d:b;}
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | include<cstdio>
|
s372208787 | p00174 | C | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)} | main.c:1:1: warning: data definition has no type or storage class
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'a' [-Wimplicit-int]
main.c:1:3: error: type defaults to 'int' in declaration of 'b' [-Wimplicit-int]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^
main.c:1:5: error: type defaults to 'int' in declaration of 'p' [-Wimplicit-int]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^
main.c:1:7: error: return type defaults to 'int' [-Wimplicit-int]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^~~~
main.c: In function 'main':
main.c:1:7: error: type of 'c' defaults to 'int' [-Wimplicit-int]
main.c:1:25: error: implicit declaration of function 'getchar' [-Wimplicit-function-declaration]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^~~~~~~
main.c:1:1: note: 'getchar' is defined in header '<stdio.h>'; this is probably fixable by adding '#include <stdio.h>'
+++ |+#include <stdio.h>
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
main.c:1:79: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^~~~~~
main.c:1:79: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:79: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:79: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:104: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^~~~
main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit'
+++ |+#include <stdlib.h>
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
main.c:1:104: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch]
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^~~~
main.c:1:104: note: include '<stdlib.h>' or provide a declaration of 'exit'
main.c:1:111: error: expected ';' before '}' token
1 | a,b,p;main(c){for(;c=48-getchar();p=c)p<38?c-38?c%2?a++:b++:(a>b?a++:b++,a=b=!printf("%d %d\n",a,b)):0;exit(0)}
| ^
| ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.