submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s944266292 | p00106 | C++ | #include<iostream>
using namespace std;
int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};
int dp[50+1];
void solve(){
for(int i=0;i<51;i++){
dp[i]=INT_MAX/3;
}
dp[0]=0;
for(int i=0;i<6;i++){
for(int j=w[i];j<=50;j++){
dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
}
}
}
int main(){
solve();
int n;
while(cin>>n){
if(n==0)break;
n/=100;
cout<<dp[n]<<endl;
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:10:15: error: 'INT_MAX' was not declared in this scope
10 | dp[i]=INT_MAX/3;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include<iostream>
+++ |+#include <climits>
2 | using namespace std;
|
s633555876 | p00106 | C++ | #include<iostream>
using namespace std;
int w[]={2,3,5,10,12,15};
int v[]={380,550,850,1520,1870,2244};
int dp[50+1];
void solve(){
for(int i=0;i<51;i++){
dp[i]=INT_MAX/3;
}
dp[0]=0;
for(int i=0;i<6;i++){
for(int j=w[i];j<=50;j++){
dp[j]=min(dp[j],dp[j-w[i]]+v[i]);
}
}
}
int main(){
solve();
int n;
while(cin>>n){
if(n==0)break;
n/=100;
cout<<dp[n]<<endl;
}
return 0;
} | a.cc: In function 'void solve()':
a.cc:10:15: error: 'INT_MAX' was not declared in this scope
10 | dp[i]=INT_MAX/3;
| ^~~~~~~
a.cc:2:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
1 | #include<iostream>
+++ |+#include <climits>
2 | using namespace std;
|
s705905342 | p00106 | C++ | #include<iostream>
#include<algorithm>
#define INF 1<<28
using namespace std;
int solve(int n){
int res = INF;
if(!n) return 0;
if(n < 0) return INF;
return res = min(res, min(solve(n-1000)+1520, min(solve(n-1200)+1870, min(solve(n-1500)+2244, min(solve(n-200)+380, min(solve(n-300)+550, solve(n-500)+850))))));
}
int main(n){ while(cin >> n, n) cout << solve(n) << endl; } | a.cc:13:5: error: cannot declare '::main' to be a global variable
13 | int main(n){ while(cin >> n, n) cout << solve(n) << endl; }
| ^~~~
a.cc:13:10: error: 'n' was not declared in this scope
13 | int main(n){ while(cin >> n, n) cout << solve(n) << endl; }
| ^
|
s917132360 | p00106 | C++ | #include<iostream>
#include<cstring>
#include<algorithm>
#define Kinds 6
#define DP 50
const int cost[Kinds]={380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};
const int Volume[Kinds]={200,300,500,1000,1200,1500};
unsigned int dp[DP];
int main(){
int n;
memset(dp,10000000,sizeof(dp));
dp[0]=0;
for(int i=0;i<DP;++i)
for(int l=0;l<Kinds;++l)
if(i-Volume[l]/100>=0)
dp[i]=std::min(dp[i],dp[i-Volume[l]/100]+cost[l]);
while( std::cin>>n, n )
std::cout<<dp[n/100]<<std::endl;
return 0;
} | a.cc:7:41: error: narrowing conversion of '1.52e+3' from 'double' to 'int' [-Wnarrowing]
7 | const int cost[Kinds]={380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};
| ~~~~~^~~~
a.cc:7:51: error: narrowing conversion of '1.87e+3' from 'double' to 'int' [-Wnarrowing]
7 | const int cost[Kinds]={380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};
| ~~~~~^~~~~
a.cc:7:62: error: narrowing conversion of '2.244e+3' from 'double' to 'int' [-Wnarrowing]
7 | const int cost[Kinds]={380,550,850,380*5*0.8,550*4*0.85,850*3*0.88};
| ~~~~~^~~~~
|
s642310949 | p00107 | Java | import java.util.Arrays;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
while(true){
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
if(a==0&&ab==0&&c==0) break;
int array[] = {a, b, c};
Arrays.sort(array);
double num = Math.hypot(array[0], array[1])/2;
int n=sc.nextInt();
for(int i = 0; i < n; i++){
System.out.println(sc.nextInt() > num? "OK" : "NA");
}
}
}
}
| Main.java:10: error: cannot find symbol
if(a==0&&ab==0&&c==0) break;
^
symbol: variable ab
location: class Main
1 error
|
s823214829 | p00107 | Java | import java.util.*;
public class Main
public static void main(String[] args){
Scanner stdIn = new Scanner(System.in);
int[] x = new int[3];
for(int i = 0; i < 3; i++){
x[i] = stdIn.nextInt();
}
while( x[0] != 0 || x[1] != 0 || x[2] != 0 ){
for(int i = 0; i < 3; i++){
int max = i;
for(int j = i+1; j < 3; j++){
if( x[j] > x[max] ){
max = j;
}
}
int temp = x[max];
x[max] = x[i];
x[i] = temp;
}
double r = Math.hypot(x[1],x[2])/2;
System.out.println(r);
int n = stdIn.nextInt();
for(int i = 0; i < n; i++){
int m = stdIn.nextInt();
if( m <= r ){
System.out.println("NA");
} else {
System.out.println("OK");
}
}
x[0] = stdIn.nextInt();
x[1] = stdIn.nextInt();
x[2] = stdIn.nextInt();
}
}
} | Main.java:3: error: '{' expected
public class Main
^
Main.java:4: 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:39: error: class, interface, enum, or record expected
}
^
3 errors
|
s576643488 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
for(;;)
{
scanf("%d",&d);
if(d==0 0 0) break;
if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
printf("OK");
else
("NA");
}
return 0;
} | main.c: In function 'main':
main.c:8:13: error: 'd' undeclared (first use in this function)
8 | scanf("%d",&d);
| ^
main.c:8:13: note: each undeclared identifier is reported only once for each function it appears in
main.c:9:8: error: expected ')' before numeric constant
9 | if(d==0 0 0) break;
| ~ ^~
| )
main.c:10:48: error: expected ')' before ':' token
10 | if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
| ~ ^
| )
|
s047857190 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d;
scanf("%d %d %d",&a,&b,&c);
for(;;)
{
scanf("%d",&d);
if(d==0 0 0) break;
if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
printf("OK");
else
("NA");
}
return 0;
} | main.c: In function 'main':
main.c:9:8: error: expected ')' before numeric constant
9 | if(d==0 0 0) break;
| ~ ^~
| )
main.c:10:48: error: expected ')' before ':' token
10 | if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
| ~ ^
| )
|
s053831173 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,f;
scanf("%d %d %d",&a,&b,&c);
for(;;)
{
scanf("%d",&d);
if(d==0) scanf("%d %d",&e,&f);
if(e==0 && f==0)break;
if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
printf("OK");
else
("NA");
}
return 0;
} | main.c: In function 'main':
main.c:11:48: error: expected ')' before ':' token
11 | if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d:d)
| ~ ^
| )
|
s654762226 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,f;
scanf("%d %d %d",&a,&b,&c);
for(;;)
{
scanf("%d",&d);
if(d==0) scanf("%d %d",&e,&f);
if(e==0 && f==0)break;
if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d*d)
printf("OK");
else
(printf"NA");
}
return 0;
} | main.c: In function 'main':
main.c:14:8: error: expected ')' before string constant
14 | (printf"NA");
| ~ ^~~~
| )
|
s479057770 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d,e,f;
scanf("%d %d %d",&a,&b,&c);
for(;;)
{
scanf("%d",&d)
if(d==0 0 0) break;
if(a*a+b*b<=2*d*d || b*b+c*c<=d*d || a*a+c*c<=d*d)
printf("OK");
else
printf("NA");
}
return 0;
} | main.c: In function 'main':
main.c:8:15: error: expected ';' before 'if'
8 | scanf("%d",&d)
| ^
| ;
9 | if(d==0 0 0) break;
| ~~
|
s212105863 | p00107 | C | #include<stdio.h>
int main(void)
{
int a,b,c,d;
int z,y,x,w,v,u,t,s;
char kitune;
scanf("%d %d %d",&a,&b,&c);
z=a*a;
y=b*b;
x=c*c;
scanf("%d",&d);
for(i=0;i<=d;i++)
{
scanf("%d",&w);
if(w==0)
{
scanf("%d",&t);
if(t==0)
{
scanf("%d",&s);
if(s==0) break;
else {goto kitune;}
}
else
{
goto kitune;
}
}
else
{
kitune:
v=2*w;
u=w*w;
if(z+y<=u || z+x<=u || y+x<=u) printf("OK\n");
else printf("NA\n");
}
}
return 0;
} | main.c: In function 'main':
main.c:12:9: error: 'i' undeclared (first use in this function)
12 | for(i=0;i<=d;i++)
| ^
main.c:12:9: note: each undeclared identifier is reported only once for each function it appears in
|
s119092784 | p00107 | C | include<stdio.h>
main(){
int t,y,h,n,i,r,temp,a[10010];
scanf("%d%d%d%d",&t,&y,&h,&n);
for(i=0;i<n;i++){
scanf("%d",&a[i]);
}
if(y<t){
temp=t;
t=y;
y=temp;
}
if(h<y){
temp=h;
h=y;
y=temp;
}
if(y<t){
temp=t;
t=y;
y=temp;
}
printf("%d%d%d\n",t,y,h);
for(i=0;i<n;i++){
r=sqrt(t*t+y*y)/2;
if(a[i]<=r){
printf("NA\n");
}
else{
printf("OK\n");
}
}
return 0;
} | main.c:1:8: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token
1 | include<stdio.h>
| ^
|
s784447530 | p00107 | C |
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <memory>
#include <string>
#include <algorithm>
#include <complex>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <bitset>
using namespace std;
#ifdef _MSC_VER
#define __typeof__ decltype
#define strtok_r strtok_s
#endif
#define ITER(c) __typeof__((c).begin())
#define FOREACH(it, c) for (ITER(c) it=(c).begin(); it != (c).end(); ++it)
#define RITER(c) __typeof__((c).rbegin())
#define RFOREACH(it, c) for (RITER(c) it=(c).rbegin(); it != (c).rend(); ++it)
#define REP(i, n) REPEAT(i, 0, n)
#define RREP(i, n) RREPEAT(i, 0, n)
#define REPEAT(i, k, n) for(int i = (k); i < (k+n); ++i)
#define RREPEAT(i, k, n) for(int i = (k)+(n)-1; i >= (k); --i)
#define FROMTO(i,f,t) for(int i = f; i < t; i++)
#define ALL(c) (c).begin(), (c).end()
#define LLPOW(p1,p2) ((ll)pow((double)(p1), (int)p2))
#define ESIZEOF(A) (sizeof(A)/sizeof((A)[0]))
#define CIN_NO_SYNC do { cin.tie(0); ios_base::sync_with_stdio(false); } while(0)
#define GETSTR(p) fgets((p), sizeof(p), stdin)
#define CHOMP(p) do{ char *_q = (p) + strlen(p)-1; if(*_q == '\n' || *_q == '\r') *_q = 0; } while(0)
#define FILL(m,v) memset(m, v, sizeof(m))
#define mp make_pair
#define pb push_back
template<class _T> _T MAX(_T p1,_T p2){return (p1>p2)?p1:p2;}
template<class _T> _T MIN(_T p1,_T p2){return (p1<p2)?p1:p2;}
typedef long long ll;
typedef unsigned long long ull;
#define X real()
#define Y imag()
typedef double D;
typedef complex<D> P;
#define EPS (1e-9)
#ifdef _DEBUG
template<class _T>
inline void _prfe(const char *_n, _T _c, bool _p = false){
ITER(_c) _it=_c.begin();
if(_p){ cout<<_n<<" = ["<<endl;for(;_it!=_c.end();++_it)cout<<" "<<*_it<<endl;cout<<"]"<<endl; }
else{ cout<<_n<<" = [ "<<*_it++;for(;_it!=_c.end();++_it)cout<<", "<<*_it;cout<<" ]"<<endl; }
}
#define pf printf
#define pr(n) do{cout<<#n" = "<<(n)<<endl;}while(0)
#define prfe(n) _prfe(#n, n)
#define prfep(n) _prfe(#n, n, true)
#define dbgchk(n) do{if(n)throw;}while(0)
#else
#define pf(...) /* */
#define pr(...) /* */
#define prfe(...) /* */
#define prfep(...) /* */
#define dbgchk(...) /* */
#endif
int main(){
int a[3], n, m;
while(1){
cin >> a[0] >> a[1] >> a[2];
if(a[0] == 0 && a[1] == 0 && a[2] == 0) break;
sort(a,a+3);
cin >> n;
double l1 = a[0]/2.0, l2 = a[1]/2.0;
double r = sqrt(l1*l1+l2*l2);
REP(i,n){
cin >> m;
puts((m > r)?"OK":"NA");
}
}
return 0;
} | main.c:4:10: fatal error: cfloat: No such file or directory
4 | #include <cfloat>
| ^~~~~~~~
compilation terminated.
|
s667458761 | p00107 | C++ | #include<stdio.h>
int main(){
int x,y,z,N,r;
while(scanf("%d %d %d",&n[0],&n[1],&n[2])!=EOF){
for(int i=0;i<3;i++)
for(int j=2;j>i;j--)
if(n[j-1]>n[j]){int t=n[j];n[j]=n[j-1];n[j-1]=t;}
scanf("%d",&N);
for(int i=0;i<N;i++){
scanf("%d",&r);
if(n[1]>r*1.4141356)printf("NA\n");
else printf("OK\n");
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:25: error: 'n' was not declared in this scope
6 | while(scanf("%d %d %d",&n[0],&n[1],&n[2])!=EOF){
| ^
|
s664756881 | p00107 | C++ |
#include<iostream>
using namespace std;
int main(){
double w,h,d,r;
double pi=3.141592653,s;
int n;
while(1){
cin >> w >> h >> d;
if(w+h+d==0) break;
cin >> n;
while(n--){
cin >> r;
r*=2;
double dw.dh,dd;
dw=sqrt(w*w+h*h);
dh=sqrt(h*h+d*d);
dd=sqrt(d*d+w*w);
if(dw<r||dh<r||dd<r) cout<<"OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:16:10: error: expected initializer before '.' token
16 | double dw.dh,dd;
| ^
a.cc:17:1: error: 'dw' was not declared in this scope; did you mean 'd'?
17 | dw=sqrt(w*w+h*h);
| ^~
| d
a.cc:17:4: error: 'sqrt' was not declared in this scope
17 | dw=sqrt(w*w+h*h);
| ^~~~
a.cc:18:1: error: 'dh' was not declared in this scope; did you mean 'd'?
18 | dh=sqrt(h*h+d*d);
| ^~
| d
a.cc:19:1: error: 'dd' was not declared in this scope; did you mean 'd'?
19 | dd=sqrt(d*d+w*w);
| ^~
| d
|
s890483466 | p00107 | C++ | #include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
int tate,yoko,takasa,mn,md;
int n;
while(cin>>tate>>yoko>>takasa, tate|| yoko || takasa){
cin>>n;
int* r = new int [n];
mn=min(min(tate , yoko) , takasa);
if(tate>=yoko){
if(yoko>=takasa) {
md=yoko;
} else if (yoko<takasa) {
if(tate>=takasa) md=takasa;
else if (tate<takasa) md=tate;
}
} else if (tate<yoko){
if (tate>=takasa){
md=tate;
} else if(tate<takasa){
if(yoko>=takasa) md=takasa;
else if(yoko<takasa) md=yoko;
}
}
for(int i=0;i<n;++i){
cin>> r[i];
cout << ((r[i]*r[i]*4>mn*mn+md*md) ? "OK" : "NA") << endl;
}
}
delete [] r;
return 0;
} | a.cc: In function 'int main()':
a.cc:39:19: error: 'r' was not declared in this scope
39 | delete [] r;
| ^
|
s488806870 | p00107 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int a,b,c;
cin>>a>>b>>c;
int r[100];
int n=0;
while(true){
int temp;
cin>>temp;
if(n>=2&&temp==0&&r[n-1]==0&&r[n-2]==0){
break;
}
else{
r[n]=temp;
n=n++;
}
}
int rec1,rec2,rec3;
rec1=sqrt(a*a+b*b);
rec2=sqrt(a*a+c*c);
rec3=sqrt(b*b+c*c);
for (int i=0;i<n;i++){
if (2*r[i]>rec1||2*r[i]>rec2||2*r[i]>rec3){
cout<<"OK"<<endl;
}
else{
cout<<"NA"<<endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:14: error: 'sqrt' was not declared in this scope
22 | rec1=sqrt(a*a+b*b);
| ^~~~
|
s434716032 | p00107 | C++ | #include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
while(1) {
int a, b, c;
cin >> a >> b >> c;
vector<int>s{ a,b,c };
if (!a && !b && !c)break;
sort(s[0],s[1]);
int d;
cin >> d;
for (int e = 0; e < d; e++) {
int f;
cin >> f;
if (f*2>s[1])cout << "OK" << endl;
else cout << "NA" << endl;
}
}
} | In file included from /usr/include/c++/14/algorithm:61,
from a.cc:4:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:7: required from here
14 | sort(s[0],s[1]);
| ~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1780:17: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~
In file included from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1780:25: error: invalid type argument of unary '*' (have 'int')
1780 | __val = _GLIBCXX_MOVE(*__i);
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1782:15: error: invalid type argument of unary '*' (have 'int')
1782 | *__first = _GLIBCXX_MOVE(__val);
| ^~~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:71,
from /usr/include/c++/14/string:51,
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:
/usr/include/c++/14/bits/predefined_ops.h: In instantiation of 'constexpr bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = int; _Iterator2 = int]':
/usr/include/c++/14/bits/stl_algo.h:1777:14: required from 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1777 | if (__comp(__i, __first))
| ~~~~~~^~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1817:25: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1817 | std::__insertion_sort(__first, __first + int(_S_threshold), __comp);
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1908:31: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1908 | std::__final_insertion_sort(__first, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:7: required from here
14 | sort(s[0],s[1]);
| ~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:16: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
/usr/include/c++/14/bits/predefined_ops.h:45:25: error: invalid type argument of unary '*' (have 'int')
45 | { return *__it1 < *__it2; }
| ^~~~~~
In file included from /usr/include/c++/14/bits/stl_algo.h:61:
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1593:23: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1593 | std::__make_heap(__first, __middle, __comp);
| ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:7: required from here
14 | sort(s[0],s[1]);
| ~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:344:11: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
344 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:346:11: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
346 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h: In instantiation of 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare&) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/14/bits/stl_algo.h:1596:19: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1596 | std::__pop_heap(__first, __middle, __i, __comp);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1868:25: required from 'void std::__partial_sort(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1868 | std::__heap_select(__first, __middle, __last, __comp);
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1884:27: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = int; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1884 | std::__partial_sort(__first, __last, __last, __comp);
| ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1905:25: required from 'void std::__sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]'
1905 | std::__introsort_loop(__first, __last,
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
1906 | std::__lg(__last - __first) * 2,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1907 | __comp);
| ~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:4772:18: required from 'void std::sort(_RAIter, _RAIter) [with _RAIter = int]'
4772 | std::__sort(__first, __last, __gnu_cxx::__ops::__iter_less_iter());
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:14:7: required from here
14 | sort(s[0],s[1]);
| ~~~~^~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:258:9: error: no type named 'value_type' in 'struct std::iterator_traits<int>'
258 | _ValueType;
| ^~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:260:9: error: no type named 'difference_type' in 'struct std::iterator_traits<int>'
260 | _DistanceType;
| ^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_heap.h:262:28: error: invalid typ |
s588338322 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size[3];
int n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:9:12: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::vector<int>')
9 | std::cin >> size[0];
| ~~~~~~~~ ^~ ~~~~~~~
| | |
| | std::vector<int>
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::vector<int>' to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ^~~~~~~~
/usr/include/c++/14/istream:133:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
133 | operator>>(ios_base& (*__pf)(ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:352:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]'
352 | operator>>(__streambuf_type* __sb);
| ^~~~~~~~
/usr/include/c++/14/istream:352:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_istream<char>::__streambuf_type*' {aka 'std::basic_streambuf<char>*'}
352 | operator>>(__streambuf_type* __sb);
| ~~~~~~~~~~~~~~~~~~^~~~
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,
|
s337678733 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size[3];
int x, n, r;
std::cin >> x;
size[0] = x;
std::cin >> x;
size[1] = x;
std::cin >> x;
size[2] = x;
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:13: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
10 | size[0] = x;
| ^
In file included from /usr/include/c++/14/vector:72,
from a.cc:2:
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66:
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:12:13: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
12 | size[1] = x;
| ^
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:14:13: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'int')
14 | size[2] = x;
| ^
/usr/include/c++/14/bits/vector.tcc:210:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
210 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:211:42: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&'
211 | operator=(const vector<_Tp, _Alloc>& __x)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:766:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:766:26: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&'
766 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
| ~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:788:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
788 | operator=(initializer_list<value_type> __l)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:788:46: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>'
788 | operator=(initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
a.cc:15:8: error: request for member 'sort' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~
a.cc:15:18: error: request for member 'begin' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~~
a.cc:15:32: error: request for member 'end' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~
a.cc:17:9: error: 'd' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:17: error: 'w' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:25: error: 'h' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:20:10: error: expected primary-expression before ';' token
20 | std;;cin >> r;
| ^
a.cc:20:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
20 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:21:11: error: no match for 'operator>' (operand types are 'int' and 'std::vector<int>')
21 | if(r>size[1]){
| ~^~~~~~~~
| | |
| int std::vector<int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::op |
s534293200 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size[3];
int x, n, r;
std::cin >> x;
size.push(x);
std::cin >> x;
size.push(x);
std::cin >> x;
size.push(x);
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:8: error: request for member 'push' in 'size', which is of non-class type 'std::vector<int> [3]'
10 | size.push(x);
| ^~~~
a.cc:12:8: error: request for member 'push' in 'size', which is of non-class type 'std::vector<int> [3]'
12 | size.push(x);
| ^~~~
a.cc:14:8: error: request for member 'push' in 'size', which is of non-class type 'std::vector<int> [3]'
14 | size.push(x);
| ^~~~
a.cc:15:8: error: request for member 'sort' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~
a.cc:15:18: error: request for member 'begin' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~~
a.cc:15:32: error: request for member 'end' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~
a.cc:17:9: error: 'd' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:17: error: 'w' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:25: error: 'h' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:20:10: error: expected primary-expression before ';' token
20 | std;;cin >> r;
| ^
a.cc:20:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
20 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:21:11: error: no match for 'operator>' (operand types are 'int' and 'std::vector<int>')
21 | if(r>size[1]){
| ~^~~~~~~~
| | |
| int std::vector<int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const _CharT*' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
21 | if(r>size[1]){
| ^
|
s645040985 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size[3];
int x, n, r;
std::cin >> x;
size.insert(0, x);
std::cin >> x;
size.insert(1, x);
std::cin >> x;
size.insert(2, x);
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:8: error: request for member 'insert' in 'size', which is of non-class type 'std::vector<int> [3]'
10 | size.insert(0, x);
| ^~~~~~
a.cc:12:8: error: request for member 'insert' in 'size', which is of non-class type 'std::vector<int> [3]'
12 | size.insert(1, x);
| ^~~~~~
a.cc:14:8: error: request for member 'insert' in 'size', which is of non-class type 'std::vector<int> [3]'
14 | size.insert(2, x);
| ^~~~~~
a.cc:15:8: error: request for member 'sort' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~
a.cc:15:18: error: request for member 'begin' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~~~
a.cc:15:32: error: request for member 'end' in 'size', which is of non-class type 'std::vector<int> [3]'
15 | size.sort(size.begin(), size.end());
| ^~~
a.cc:17:9: error: 'd' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:17: error: 'w' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:25: error: 'h' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:20:10: error: expected primary-expression before ';' token
20 | std;;cin >> r;
| ^
a.cc:20:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
20 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
a.cc:21:11: error: no match for 'operator>' (operand types are 'int' and 'std::vector<int>')
21 | if(r>size[1]){
| ~^~~~~~~~
| | |
| int std::vector<int>
In file included from /usr/include/c++/14/string:48,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41:
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
462 | operator>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:462:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
507 | operator>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:507:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1714 | operator>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1714:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1774 | operator>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1774:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::move_iterator<_IteratorL>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1058 | operator>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1058:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::pair<_T1, _T2>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:695:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
695 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:695:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/string_view:702:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
702 | operator> (basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:702:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/string_view:710:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
710 | operator> (__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:710:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: 'std::vector<int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3915:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3915 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3915:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3929:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3929 | operator>(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3929:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>' and 'int'
21 | if(r>size[1]){
| ^
/usr/include/c++/14/bits/basic_string.h:3942:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3942 | operator>(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3942:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const _CharT*' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2619:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator>(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2619 | operator>(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2619:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::tuple<_UTypes ...>' and 'int'
21 | if(r>size[1]){
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)'
2102 | operator>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:2102:5: note: template argument deduction/substitution failed:
a.cc:21:18: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int'
21 | if(r>size[1]){
| ^
|
s781387750 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size;
int x, n, r;
std::cin >> x;
size.insert(0, x);
std::cin >> x;
size.insert(1, x);
std::cin >> x;
size.insert(2, x);
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:14: error: no matching function for call to 'std::vector<int>::insert(int, int&)'
10 | size.insert(0, x);
| ~~~~~~~~~~~^~~~~~
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
1484 | insert(const_iterator __position, _InputIterator __first,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/vector:72:
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
133 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:135:27: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
135 | insert(const_iterator __position, const value_type& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
1395 | insert(const_iterator __position, value_type&& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1395 | insert(const_iterator __position, value_type&& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]'
1439 | insert(const_iterator __position, size_type __n, const value_type& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 2 provided
a.cc:12:14: error: no matching function for call to 'std::vector<int>::insert(int, int&)'
12 | size.insert(1, x);
| ~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
1484 | insert(const_iterator __position, _InputIterator __first,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
133 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:135:27: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
135 | insert(const_iterator __position, const value_type& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
1395 | insert(const_iterator __position, value_type&& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1395 | insert(const_iterator __position, value_type&& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]'
1439 | insert(const_iterator __position, size_type __n, const value_type& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 2 provided
a.cc:14:14: error: no matching function for call to 'std::vector<int>::insert(int, int&)'
14 | size.insert(2, x);
| ~~~~~~~~~~~^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, _InputIterator, _InputIterator) [with <template-parameter-2-2> = _InputIterator; _Tp = int; _Alloc = std::allocator<int>]'
1484 | insert(const_iterator __position, _InputIterator __first,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1484:9: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/vector.tcc:133:5: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
133 | vector<_Tp, _Alloc>::
| ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/vector.tcc:135:27: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
135 | insert(const_iterator __position, const value_type& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; value_type = int]'
1395 | insert(const_iterator __position, value_type&& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1395:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1395 | insert(const_iterator __position, value_type&& __x)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1413:29: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1413 | insert(const_iterator __position, initializer_list<value_type> __l)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(const_iterator, size_type, const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator; size_type = long unsigned int; value_type = int]'
1439 | insert(const_iterator __position, size_type __n, const value_type& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1439:7: note: candidate expects 3 arguments, 2 provided
a.cc:15:8: error: 'class std::vector<int>' has no member named 'sort'
15 | size.sort(size.begin(), size.end());
| ^~~~
a.cc:17:9: error: 'd' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:17: error: 'w' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:25: error: 'h' was not declared in this scope
17 | while(d!=0 && w!=0 && h!=0){
| |
s227827434 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size;
int x, n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:12:8: error: 'class std::vector<int>' has no member named 'sort'
12 | size.sort(size.begin(), size.end());
| ^~~~
a.cc:14:9: error: 'd' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:17: error: 'w' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:25: error: 'h' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:10: error: expected primary-expression before ';' token
17 | std;;cin >> r;
| ^
a.cc:17:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s489209781 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
vector<int> size;
int x, n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
size.sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:6:3: error: 'vector' was not declared in this scope
6 | vector<int> size;
| ^~~~~~
a.cc:6:3: note: suggested alternatives:
In file included from /usr/include/c++/14/vector:66,
from a.cc:2:
/usr/include/c++/14/bits/stl_vector.h:428:11: note: 'std::vector'
428 | class vector : protected _Vector_base<_Tp, _Alloc>
| ^~~~~~
/usr/include/c++/14/vector:93:13: note: 'std::pmr::vector'
93 | using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
| ^~~~~~
a.cc:6:10: error: expected primary-expression before 'int'
6 | vector<int> size;
| ^~~
a.cc:9:15: error: 'size' was not declared in this scope; did you mean 'std::size'?
9 | std::cin >> size[0];
| ^~~~
| std::size
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: 'std::size' declared here
272 | size(const _Tp (&)[_Nm]) noexcept
| ^~~~
a.cc:14:9: error: 'd' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:17: error: 'w' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:25: error: 'h' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:10: error: expected primary-expression before ';' token
17 | std;;cin >> r;
| ^
a.cc:17:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | std;;cin >> r;
| ^~~
| std::cin
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s485663179 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size;
int x, n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
std::sort(size.begin(), size.end());
while(d!=0 && w!=0 && h!=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:9: error: 'd' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:17: error: 'w' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:14:25: error: 'h' was not declared in this scope
14 | while(d!=0 && w!=0 && h!=0){
| ^
a.cc:17:10: error: expected primary-expression before ';' token
17 | std;;cin >> r;
| ^
a.cc:17:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s161096829 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size;
int x, n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
std::sort(size.begin(), size.end());
while(size[0]=0 && size[1]=0 && size[2]=0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
std::sort(size.begin(), size.end());
}
return 0;
} | a.cc: In function 'int main()':
a.cc:14:32: error: lvalue required as left operand of assignment
14 | while(size[0]=0 && size[1]=0 && size[2]=0){
a.cc:17:10: error: expected primary-expression before ';' token
17 | std;;cin >> r;
| ^
a.cc:17:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s691509989 | p00107 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
int main(){
std::vector<int> size;
int x, n, r;
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
std::sort(size.begin(), size.end());
while(size[0]==0 && size[1]==0 && size[2]==0){
std::cin >> n;
for(int i=0; i<n; i++){
std;;cin >> r;
if(r>size[1]){
std::cout << "OK" << std::endl;
}else{
std::cout << "NA" << std::endl;
}
}
std::cin >> size[0];
std::cin >> size[1];
std::cin >> size[2];
std::sort(size.begin(), size.end());
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:10: error: expected primary-expression before ';' token
17 | std;;cin >> r;
| ^
a.cc:17:12: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
17 | std;;cin >> r;
| ^~~
| std::cin
In file included from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
62 | extern istream cin; ///< Linked to standard input
| ^~~
|
s956429395 | p00107 | C++ | #include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(){
double d,w,h,r,min,dw,wh,hd;
int n;
while(true){
scanf("%lf %lf %lf",&d,&w,&h);
if(d == 0.0 && w == 0.0 && h == 0.0)break;
scanf("%d",&n);
for(int i=0; i < n; i++){
scanf("%lf",&r);
dw = (sqrt(d*d+w*w))/2.0;
wh = (sqrt(w*w+h*h))/2.0;
hd = (sqrt(d*d+h*h))/2.0;
min = min(dw,min(wh,hd));
if(r > min){
printf("OK\n");
}else{
printf("NA\n");
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:29: error: 'min' cannot be used as a function
24 | min = min(dw,min(wh,hd));
| ~~~^~~~~~~
a.cc:24:36: error: 'min' cannot be used as a function
24 | min = min(dw,min(wh,hd));
| ^
|
s649873020 | p00107 | C++ | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}} | a.cc:1:15: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
| ^~~~
a.cc: In function 'int main()':
a.cc:1:33: error: 'cin' is not a member of 'std'
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
| ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
+++ |+#include <iostream>
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
a.cc:1:73: error: 'cin' is not a member of 'std'
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
| ^~~
a.cc:1:73: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:1:95: error: 'cin' is not a member of 'std'
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
| ^~~
a.cc:1:95: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:1:109: error: 'puts' was not declared in this scope
1 | int a,b,c,n,r;main(){while(std::cin>>a>>b>>c,a|b|c){a*=a;b*=b;c*=c;std::cin>>n;while(n--)std::cin>>r,r*=4*r,puts(a+b<r|b+c<r|c+a<r?"OK":"NA");}}
| ^~~~
|
s160582490 | p00107 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,c,n,r,R;
while( cin >> a >> b >> c , a || b || c ){
cin >> n;
for(int i=0 ; i < n ; i++ ){
bool ans = true;
cin >> r;
R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
if( 2*r <= R ) ans = false;
cout << (ans?"OK":"NA") << endl;
}
}
} | a.cc: In function 'int main()':
a.cc:11:39: error: 'sqrt' was not declared in this scope
11 | R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
| ^~~~
|
s862559260 | p00107 | C++ | #include<stdio.h>
#include<math.h>
#include<algorithm>
int main(){int a,b,c,n,r;for(;scanf("%d%d%d",&a,&b,&c),a|b|c;)for(scanf("%d",&n);n--;puts( (2*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?"OK":"NA"));scanf("%d",&r);} | a.cc: In function 'int main()':
a.cc:4:102: error: 'min' was not declared in this scope; did you mean 'std::min'?
4 | int main(){int a,b,c,n,r;for(;scanf("%d%d%d",&a,&b,&c),a|b|c;)for(scanf("%d",&n);n--;puts( (2*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?"OK":"NA"));scanf("%d",&r);}
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:4:98: error: 'min' was not declared in this scope; did you mean 'std::min'?
4 | int main(){int a,b,c,n,r;for(;scanf("%d%d%d",&a,&b,&c),a|b|c;)for(scanf("%d",&n);n--;puts( (2*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?"OK":"NA"));scanf("%d",&r);}
| ^~~
| std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s572076917 | p00107 | C++ | #include <iostream>
using namespace std;
int main(){
int a,b,c,n,r,R;
while( cin >> a >> b >> c , a || b || c ){
cin >> n;
for(int i=0 ; i < n ; i++ ){
bool ans = true;
cin >> r;
R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
if( 2*r <= R ) ans = false;
cout << (ans?"OK":"NA") << endl;
}
}
} | a.cc: In function 'int main()':
a.cc:11:39: error: 'sqrt' was not declared in this scope
11 | R = min( min( sqrt(a*a+b*b),sqrt(b*b+c*c) ),sqrt(c*c+a*a) );
| ^~~~
|
s888748412 | p00107 | C++ | #include<stdio.h>
#include<math.h>
#include<algorith>
//#define M(a,b) a<b?a:b
int main(){
int a,b,c,n,r;
for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
for(scanf("%d",&n);n--;){
scanf("%d",&r);
puts(
(2.*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
"OK":"NA"
);
}
}
} | a.cc:3:9: fatal error: algorith: No such file or directory
3 | #include<algorith>
| ^~~~~~~~~~
compilation terminated.
|
s961201992 | p00107 | C++ | #include<stdio.h>
#include<math.h>
#include<algorithm>
//#define M(a,b) a<b?a:b
int main(){
int a,b,c,n,r;
for(;scanf("%d%d%d",&a,&b,&c),a|b|c;){
for(scanf("%d",&n);n--;){
scanf("%d",&r);
puts(
(2.*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
"OK":"NA"
);
}
}
} | a.cc: In function 'int main()':
a.cc:11:44: error: 'min' was not declared in this scope; did you mean 'std::min'?
11 | (2.*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
| ^~~
| std::min
In file included from /usr/include/c++/14/algorithm:61,
from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
a.cc:11:40: error: 'min' was not declared in this scope; did you mean 'std::min'?
11 | (2.*r<=min(min(sqrt(a*a+b*b),sqrt(b*b+c*c)),sqrt(c*c+a*a)))?
| ^~~
| std::min
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: 'std::min' declared here
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
|
s499079938 | p00107 | C++ | #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){
double x, w, h, n, r, min_r;
while (cin >> x >> w >> h, x || w || h){
min_r = min(sqrt(x*x+w*w), min(sqrt(x*x+h*h), sqrt(w*w+h*h)));
cin >> n;
while (n--){
cin >> r;
r*=2;
min_r < r ? cout << "OK" << endl; : cout << "NA" << endl;
}
}
} | a.cc: In function 'int main()':
a.cc:14:45: error: expected ':' before ';' token
14 | min_r < r ? cout << "OK" << endl; : cout << "NA" << endl;
| ^
| :
a.cc:14:45: error: expected primary-expression before ';' token
a.cc:14:47: error: expected primary-expression before ':' token
14 | min_r < r ? cout << "OK" << endl; : cout << "NA" << endl;
| ^
|
s490678169 | p00107 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
#define PI 3.14159265358979323846264
using namespace std;
int main(void){
int n;
double v,box_area[5],height,width,depth,min_area;
vector<double> hole;
vector<double> hole_area;
while(1){
height=0;
width=0;
depth=0;
n=0;
min_area=0;
hole.clear();
hole_area.clear();
for(int i=0;i<5;i++){
box_area[i]=0;
}
scanf("%lf %lf %lf",&height,&width,&depth);
if(height==0 && width==0 && depth==0){
break;
}
scanf("%d",&n);
for(int i=0;i<n;i++){
cin>>v;
hole.push_back(v);
}
for(int i=0;i<n;i++){
hole_area.push_back(hole[i]*2.0);
//printf("hole_area[%d]=%lf\n",i,hole_area[i]);
}
box_area[0]=sqrt(1.0*height*height+1.0*width*width); //¼ûÌÌ3ÊÌ»ê¼êÌÎpü
box_area[1]=sqrt(1.0*height*height+1.0*depth*depth);
box_area[2]=sqrt(1.0*width*width+1.0*depth*depth);
/*for(int i=0;i<3;i++){
printf("box_area[%d]=%lf\n",i,box_area[i]);
}
printf("hei=%lf wid=%lf dep=%lf\n",height,width,depth);*/
min_area=min(box_area[0],min(box_area[1],box_area[2]));
//printf("¼ûÌÌŬÊÏÍ:%lf\n",min_area);
for(int i=0;i<n;i++){
if(hole_area[i]>min_area){
printf("OK\n");
}
else{
printf("NA\n");
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:52:29: error: 'sqrt' was not declared in this scope
52 | box_area[0]=sqrt(1.0*height*height+1.0*width*width); //¼ûÌÌ3ÊÌ»ê¼êÌÎpü
| ^~~~
|
s629324779 | p00107 | C++ | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(void)
{
int a[3], n, b;
while (scanf("%d %d %d", &a[0], &a[1], &a[2]), a[0]){
sort(a, a + 3);
int r = a[0]*a[0] + a[1]*a[1];
cin >> n;
for (int i = 0; i < n; i++){
cin >> b;
if (r < (b*2)*(b*2)) cout << "OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:10:17: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
10 | sort(a, a + 3);
| ^~~~
| sqrt
|
s602735687 | p00107 | C++ | #include <iostream>
#include <math.h>
using namespace std;
int main(){
doIt();
}
void doIt(){
int a,b,c,n,i;
cin >> a >> b >> c;
while(a + b + c > 0){
cin >> n;
int r[n];
//cout << sqrt(a*a + b*b) / 2 << ", " << sqrt(b*b + c*c) / 2 << "," << sqrt(a*a + c*c) / 2;
for(i = 0; i < n; i++){
std::cin >> r[i];
//斜辺を計算する
bool bOK = false;
if(sqrt(a*a + b*b) / 2 < r[i] || sqrt(b*b + c*c) / 2 < r[i] || sqrt(c*c + a*a) / 2 < r[i]){
bOK = true;
}
if(bOK){
cout << "OK" << endl;
}
else{
cout << "NA" << endl;
}
}
cin >> a >> b >> c;
}
} | a.cc: In function 'int main()':
a.cc:6:1: error: 'doIt' was not declared in this scope
6 | doIt();
| ^~~~
|
s293380615 | p00107 | C++ | #include <cmath>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for ( int i = 0; i < n; i++ )
using namespace std;
int main() {
int n;
vector<int> s(3);
while ( cin >> s[0] >> s[1] >> s[2] >> n, s[0] || s[1] || s[2] ) {
sort(s.begin(), s.end());
// REP(i, 3) cout << s[i] << " ";
// cout << endl;
double size = sqrt(s[0] * s[0] + s[1] * s[1]);
// cout << size << " " << (s[0] * s[0]) << " " << (s[1] * s[1]) << endl;
REP(i, n) {
double r;
cin >> r;
// cout << "r:" << r*2 << " size:" << size << " r<size:" << (r*2<size) << endl;
if ( r * 2 <= size )
cout << "NA";
else
cout << "OK";
cout << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:9: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
15 | sort(s.begin(), s.end());
| ^~~~
| sqrt
|
s399613535 | p00107 | C++ | #include <iostream>
#include <cmath>
using namespace std;
int main(void){
int a[3];
while( cin >> a[0] >> a[1] >> a[2] , ( a[0] || a[1] || a[2] ) ){
int n;
cin >> n;
sort( a , a + 3 );
int R = a[0]*a[0] + a[1]*a[1];
while(n--){
int r;
cin >> r;
if( 2 * r > sqrt(R) ) cout << "OK" << endl;
else cout << "NA" << endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:13:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
13 | sort( a , a + 3 );
| ^~~~
| sqrt
|
s924558309 | p00107 | C++ | #include<iostream>
#include<algorithm>
int main(){
int data[3];
while(std::cin>>data[0]>>data[1]>>data[2],data[0],data[1],data[2]){
int n;
double min;
std::sort(data,data+3);
std::cin>>n;
min=sqrt(data[0]*data[0]+data[1]*data[1])/2;
for(int i=0,r;i<n;i++){
std::cin>>r;
if(r>min)std::cout<<"OK"<<std::endl;
else std::cout<<"NA"<<std::endl;
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:11:21: error: 'sqrt' was not declared in this scope
11 | min=sqrt(data[0]*data[0]+data[1]*data[1])/2;
| ^~~~
|
s065560610 | p00108 | Java | 10
4 5 1 1 4 5 12 3 5 4
0 | Main.java:1: error: class, interface, enum, or record expected
10
^
1 error
|
s263478025 | p00108 | Java | import java.util.Scanner;
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int array[];
while(truez){
int n = sc.nextInt();
if(n == 0)break;
array = new int[n];
for(int i = 0; i < n; i++)array[i] = sc.nextInt();
int cnt = 0;
while(true){
int[] next = new int[n];
int[] count = new int[13];
for(int i : array)count[i]++;
boolean judge = true;
for(int i = 0; i < n; i++){
next[i] = count[array[i]];
if(next[i] != array[i])judge = false;
}
if(judge){
break;
}
cnt++;
array = next;
}
System.out.println(cnt);
for(int i = 0; i < array.length -1; i++){
System.out.print(array[i] + " ");
}
System.out.println(array[array.length - 1]);
}
}
}
| Main.java:8: error: cannot find symbol
while(truez){
^
symbol: variable truez
location: class Main
1 error
|
s836121106 | p00108 | Java | import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
public class Main0108 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int N;
while((N = scan.nextInt()) != 0) {
int[] S = new int[N];
for(int i = 0; i < N; i++) {
S[i] = scan.nextInt();
}
int n = 0;
int[] prev = S;
int[] now = new int[N];
for( ; !Arrays.equals(prev, now);) {
n++;
if(n >= 2){
prev = now;
}
now = new int[N];
Map<Integer,Integer> mset = new HashMap<Integer,Integer>();
for(int i = 0; i < N; i++) {
if(mset.containsKey(prev[i])) {
mset.put(prev[i],mset.get(prev[i]).intValue()+1);
} else {
mset.put(prev[i], 1);
}
}
for(int i = 0; i < N; i++) {
now[i] = mset.get(prev[i]).intValue();
}
}
System.out.println(n-1);
for(int i = 0; i < N; i++) {
if(i > 0){
System.out.print(" ");
}
System.out.print(now[i]);
}
System.out.println();
}
scan.close();
}
} | Main.java:7: error: class Main0108 is public, should be declared in a file named Main0108.java
public class Main0108 {
^
1 error
|
s524807631 | p00108 | C | #include <stdio.h>
#define MAX 13
int main()
{
int n = 0, i = 0, flag = 0, cnt = 0;
int numline[MAX] = {};
int tmpline[MAX] = {};
int num[101] = {};
while ( scanf( "%d", &n ) == 1 ) {
if ( n == 0 ) { break; }
for ( i = 0 ; i < n ; i++ ) {
scanf( "%d", &numline[i] );
}
flag = 1;
cnt = 0;
while ( flag ) {
// B=P8=J8;zNs$N=i4|2=$r9T$&
for ( i = 0 ; i < 101 ; i++ ) {
num[i] = 0;
}
// B=P8=J8;zNs$N%+%&%s%H
for ( i = 0 ; i < n ; i++ ) {
num[numline[i]]++;
}
// B=P8=IQEYJ8;zNs$N:n@.
for ( i = 0 ; i < n ; i++ ) {
tmpline[i] = num[numline[i]];
}
cnt++;
// B=P8=IQEYJ8;zNs$rHf3S$9$k
// memcmpB$OBh#30z?tJ,$NbyteB$N0z?t$r9T$&
// B$b$7intB7?G[Ns$NHf3S$r9T$$$?$$>l9g$K$O, sizeof(int)*nB$H=q$/I,MW$,$"$k
if ( memcmp( numline, tmpline, sizeof( int )*n ) == 0 ) {
/*for ( i = 0 ; i < n ; i++ ) {
printf( "%3d %3d\n", numline[i], tmpline[i] );
}*/
flag = 0;
} else {
// B0c$&J8;zNs$N>l9g$O!"<!$NA`:n$KHw$($F?tNs$N%3%T!<$r9T$&
for ( i = 0 ; i < n ; i++ ) {
numline[i] = tmpline[i];
}
}
}
printf( "%d\n", cnt-1 );
for ( i = 0 ; i < n ; i++ ) {
if ( i == n-1 ) {
printf( "%d\n", tmpline[i] );
} else {
printf( "%d ", tmpline[i] );
}
}
}
return 0;
}
[taisa@owner-no-MacBook-Pro vol10
| main.c: In function 'main':
main.c:39:30: error: implicit declaration of function 'memcmp' [-Wimplicit-function-declaration]
39 | if ( memcmp( numline, tmpline, sizeof( int )*n ) == 0 ) {
| ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'memcmp'
1 | #include <stdio.h>
+++ |+#include <string.h>
2 |
main.c: At top level:
main.c:63:1: error: expected identifier or '(' before '[' token
63 | [taisa@owner-no-MacBook-Pro vol10
| ^
main.c:63:7: error: stray '@' in program
63 | [taisa@owner-no-MacBook-Pro vol10
| ^
|
s719562285 | p00108 | C | #include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
int i,n;
int data[12];
int chk[12];
int old_chk[12];
int flg[12];
int ans_cnt,wk,cnt,k;
char inp[96];
char *dmy_p;
char *wk_p;
while (1) {
/**--init --**/
/**--input--**/
gets(inp);
sscanf(inp,"%d",&n);
if (n == 0) {
break;
}
gets(inp);
wk_p = strtok(inp," ");
for(i=0 ;; i++) {
if (wk_p == NULL) {
break;
}
sscanf(wk_p,"%d",&(data[i]));
wk_p = strtok_s(NULL," ");
}
/**-- CALC --**/
memcpy(chk,data,sizeof(chk));
memset(old_chk,'\0',sizeof(old_chk));
ans_cnt=0;
while (1) {
ans_cnt++;
memset(flg,'\0',sizeof(flg));
for (i=0 ; i<n ; i++) {
if (flg[i]!=0) {
continue;
}
wk = chk[i];
for (cnt=0,k=0 ; k<n ; k++) {
if (flg[k]!=0) {
continue;
}
if (chk[k] == wk) {
cnt++;
}
}
for (k=0 ; k<n ; k++) {
if (flg[k]!=0) {
continue;
}
if (chk[k] == wk) {
chk[k] = cnt;
flg[k] = 1;
}
}
}
if (memcmp(chk,old_chk,sizeof(chk)) == 0) {
break;
}
memcpy(old_chk,chk,sizeof(old_chk));
}
/**-- PRINT --**/
printf("%d\n",ans_cnt-1);
for (i=0 ; i<n ; i++) {
if (i== n-1)
printf("%d",chk[i]);
else
printf("%d ",chk[i]);
}
printf("\n");
}
return 0;
} | main.c: In function 'main':
main.c:21:17: error: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
21 | gets(inp);
| ^~~~
| fgets
main.c:34:32: error: implicit declaration of function 'strtok_s'; did you mean 'strtok_r'? [-Wimplicit-function-declaration]
34 | wk_p = strtok_s(NULL," ");
| ^~~~~~~~
| strtok_r
main.c:34:30: error: assignment to 'char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
34 | wk_p = strtok_s(NULL," ");
| ^
|
s990658740 | p00108 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
#define N 1000000
int main(){
while(1){
int n, count=0;
long before[13], after[13], c[N];
scanf(" %d", &n);
if(n==0) break;
for(int i=0; i<n; ++i)scanf(" %ld", &before[i]);
//loop
bool flag=false;
while(!flag){
for(int i=0; i<=N; ++i) c[i]=0;
for(int i=0; i<n; ++i){
for(int j=0; j<n; ++j){
if(before[i] == before[j]) c[i]++;
}
}
for(int i=0; i<n; ++i) after[i]=c[i];
flag=true;
for(int i=0; i<n; ++i){
if(before[i]!=after[i]){
flag=false;
break;
}
}
/*
for(int i=0; i<n; ++i){
printf("%ld", after[i]);
if(i<n-1) printf(" ");
}
printf("\n");
*/0
count++;
for(int i=0; i<n; ++i) before[i]=after[i];
}
printf("%d\n", count-1);
for(int i=0; i<n; ++i){
printf("%ld", after[i]);
if(i<n-1) printf(" ");
}
printf("\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:43:28: error: expected ';' before 'count'
43 | */0
| ^
| ;
44 |
45 | count++;
| ~~~~~
|
s936727970 | p00108 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
int n;
string s;
while(cin>>n){
if(n==0) break;
int ct=0;
int s[13]={};
rep(i,0,n){
cin>>s[i];
}
int ans[13]={};
for(ct=0;;ct++){
memset(ans,0,sizeof(ans));
int d[13]={};
rep(i,0,n){
d[s[i]]++;
}
rep(i,0,n){
ans[i]=d[s[i]];
}
int c=0;
rep(i,0,n){
if(ans[i]==s[i]) c++;
}
if(c==n) break;
rep(i,0,n){
s[i]=ans[i];
}
}
o(ct);
rep(i,0,n){
if(i==0) cout<<ans[i];
else cout<<" "<<ans[i];
}
cout<<endl;
}
} | a.cc: In function 'int main()':
a.cc:37:25: error: 'memset' was not declared in this scope
37 | memset(ans,0,sizeof(ans));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <cmath>
+++ |+#include <cstring>
10 | #define rep(i,l,n) for(lint i=l;i<n;i++)
|
s000419720 | p00108 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
int main(){
int n;
string s;
while(cin>>n){
if(n==0) break;
int ct=0;
int s[13]={};
rep(i,0,n){
cin>>s[i];
}
int ans[13]={};
for(ct=0;;ct++){
memset(ans,0,sizeof(ans));
int d[13]={};
rep(i,0,n){
d[s[i]]++;
}
rep(i,0,n){
ans[i]=d[s[i]];
}
int c=0;
rep(i,0,n){
if(ans[i]==s[i]) c++;
}
if(c==n) break;
rep(i,0,n){
s[i]=ans[i];
}
}
o(ct);
rep(i,0,n){
if(i==0) cout<<ans[i];
else cout<<" "<<ans[i];
}
cout<<endl;
}
} | a.cc: In function 'int main()':
a.cc:37:25: error: 'memset' was not declared in this scope
37 | memset(ans,0,sizeof(ans));
| ^~~~~~
a.cc:10:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
9 | #include <cmath>
+++ |+#include <cstring>
10 | #define rep(i,l,n) for(lint i=l;i<n;i++)
|
s130587735 | p00108 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin>>n,n){
int ans[2][12]={};
for(int i=0;i<n;i++){
cin>>ans[0][i];
ans[1][i]=ans[0][i];
}
for(int i=0;;i++){
int num[100]={};
for(int j=0;j<n;j++)num[ans[0][j]]++;
bool rever=1;
for(int j=0;j<n;j++){
ans[0][j]=num[kawa[j]];
if(ans[0][j]!=ans[1][j])rever=0;
}
if(rever){
cout<<i<<endl;
for(int j=0;j<n-1;j++)cout<<ans[0][j]<<" ";
cout<<ans[0][n-1]<<endl;
break;
}
for(int j=0;j<n;j++)ans[1][j]=ans[0][j];
}
}
} | a.cc: In function 'int main()':
a.cc:17:31: error: 'kawa' was not declared in this scope
17 | ans[0][j]=num[kawa[j]];
| ^~~~
|
s656698553 | p00108 | C++ | #include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
bool check(vector<int> &a,vector<int> &b)
{
if(a.size()!=b.size())return true;
for(int i=0;i<a.size();i++)if(a[i]!=b[i])return true;
return false;
}
int main()
{
int n;
while(cin>>n&&n)
{
vector<int> a,b;
for(int i=0;i<n;i++)
{
int x;
cin>>x;
a.push_back(x);
}
int ans;
for(ans=-1;check(a,b);ans++)
{
b.clear();
for(int i=0;i<a.size();i++)
{
b.push_back(count(a.begin(),a.end(),a[i]));
}
swap(a,b);
}
cout<<ans<<endl;
for(int i=0;i<a.size();i++)
{
cout<<(i==0?"":" ")<<a[i];
}
cout<<endl;
}
} | a.cc:6:12: error: 'vector' was not declared in this scope
6 | bool check(vector<int> &a,vector<int> &b)
| ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
3 | #include <algorithm>
+++ |+#include <vector>
4 | using namespace std;
a.cc:6:19: error: expected primary-expression before 'int'
6 | bool check(vector<int> &a,vector<int> &b)
| ^~~
a.cc:6:27: error: 'vector' was not declared in this scope
6 | bool check(vector<int> &a,vector<int> &b)
| ^~~~~~
a.cc:6:27: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:6:34: error: expected primary-expression before 'int'
6 | bool check(vector<int> &a,vector<int> &b)
| ^~~
a.cc:6:41: error: expression list treated as compound expression in initializer [-fpermissive]
6 | bool check(vector<int> &a,vector<int> &b)
| ^
a.cc: In function 'int main()':
a.cc:18:17: error: 'vector' was not declared in this scope
18 | vector<int> a,b;
| ^~~~~~
a.cc:18:17: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
a.cc:18:24: error: expected primary-expression before 'int'
18 | vector<int> a,b;
| ^~~
a.cc:23:25: error: 'a' was not declared in this scope
23 | a.push_back(x);
| ^
a.cc:26:34: error: 'a' was not declared in this scope
26 | for(ans=-1;check(a,b);ans++)
| ^
a.cc:26:36: error: 'b' was not declared in this scope
26 | for(ans=-1;check(a,b);ans++)
| ^
a.cc:26:37: error: 'check' cannot be used as a function
26 | for(ans=-1;check(a,b);ans++)
| ^
a.cc:36:31: error: 'a' was not declared in this scope
36 | for(int i=0;i<a.size();i++)
| ^
|
s213001778 | p00108 | C++ | #include <iomanip>
#include <utility>
#include <vector>
#include <math.h>
#include <algorithm>
#include <string>
#include <iostream>
using namespace std;
bool mani(int a[12], int n)
{
int b[12];
fill(b, b + 12, 0);
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
if (a[i] == a[j])
b[i]++;
bool f = true;
for (int i = 0; i < n; i++)
{
if (a[i] != b[i])
{
f = false;
break;
}
}
for (int i = 0; i < n; i++)
a[i] = b[i];
return f;
} | /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
|
s913526549 | p00108 | C++ | include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
int s[2][n];
while((cin >> s[0][0]), s[0][0] != 0){
for(int i = 1; i < n ; i ++)
{
cin >> s[0][i];
}
bool fixed = false;
int src_index = 0;
int operation_count = 0;
while(!fixed)
{
map<int, int> appearance_map;
for(int i = 0; i < n ; i ++)
{
++appearance_map[s[src_index][i]];
}
fixed = true;
for(int i = 0; i < n; i++) {
s[1-src_index][i] = appearance_map[s[src_index][i]];
if(s[0][i] != s[1][i]){
fixed = false;
}
}
if(fixed)break;
src_index = 1 - src_index;
++operation_count;
}
cout << operation_count << endl;
for(int i = 0; i < n; i++) {
cout << s[0][i] << " ";
}
cout << endl;
}
} | a.cc:1:1: error: 'include' does not name a type
1 | include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
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>
| |
s102903897 | p00108 | C++ | #include <iostream>
#include <math.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n;
while(true){
cin>>n;
if(n==0){break;}
int *a=new int[n];
map<int,int>Map;
rep(i,n){
cin>>a[i];
}
for(int count=0;;count++){
rep(i,n){
Map[a[i]]++;
}
int *s=new int[n];
rep(i,n){
s[i]=Map[a[i]];
}
if(a==s){cout<<count<<endl;break;}
rep(i,n){
s[i]=a[0];
}
}
for(int i=0;i<n;i++){
if(i!=0){
cout<<" ";
}
cout<<a[i];
}
cout<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:12:9: error: 'map' was not declared in this scope
12 | map<int,int>Map;
| ^~~
a.cc:4:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
3 | #include <algorithm>
+++ |+#include <map>
4 | using namespace std;
a.cc:12:13: error: expected primary-expression before 'int'
12 | map<int,int>Map;
| ^~~
a.cc:18:25: error: 'Map' was not declared in this scope
18 | Map[a[i]]++;
| ^~~
a.cc:22:30: error: 'Map' was not declared in this scope
22 | s[i]=Map[a[i]];
| ^~~
a.cc:38:2: error: expected '}' at end of input
38 | }
| ^
a.cc:6:11: note: to match this '{'
6 | int main(){
| ^
|
s864420175 | p00108 | C++ | #include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n;
while(true){
cin>>n;
if(n==0){break;}
int *a=new int[n];
map<int,int>Map;
rep(i,n){
cin>>a[i];
}
for(int count=0;;count++){
rep(i,n){
Map[a[i]]++;
}
int *s=new int[n];
rep(i,n){
s[i]=Map[a[i]];
}
if(a==s){cout<<count<<endl;break;}
rep(i,n){
s[i]=a[0];
}
}
for(int i=0;i<n;i++){
if(i!=0){
cout<<" ";
}
cout<<a[i];
}
cout<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:40:2: error: expected '}' at end of input
40 | }
| ^
a.cc:8:11: note: to match this '{'
8 | int main(){
| ^
|
s735354241 | p00108 | C++ | #include <iostream>
#include <math.h>
#include <algorithm>
#include <map>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
int n;
while(true){
cin>>n;
if(n==0){break;}
int *a=new int[n];
map<int,int>Map;
rep(i,n){
cin>>a[i];
}
for(int count=0;;count++){
rep(i,n){
Map[a[i]]++;
}
int *s=new int[n];
rep(i,n){
s[i]=Map[a[i]];
}
if(a==s){cout<<count<<endl;break;}
rep(i,n){
s[i]=a[0];
}
}
}
for(int i=0;i<n;i++){
if(i!=0){
cout<<" ";
}
cout<<a[i];
}
cout<<endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:37:23: error: 'a' was not declared in this scope
37 | cout<<a[i];
| ^
|
s433753742 | p00108 | C++ | #include <iostream>]
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <map>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
int main()
{
int n;
while(true){
cin>>n;
if(n==0){break;}
int *a=new int[n];
map<int,int>Map;
rep(i,n){
cin>>a[i];
}
for(int cnt=0;;cnt++)
{
rep(i,n){
Map[a[i]]++;
}
int *s=new int[a[i]];
rep(i,n)
{
s[i]=Map[a[i]];
}
if(a==s)
{
cout<<cnt<<endl;
rep(i,n){
if(i!=0){
cout<<" ";
}
cout<<a[i];
}
cout<<endl;
break;
}
rep(i,n){
s[i]=a[i];
}
}
}
return 0;
}
| a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <iostream>]
| ^
a.cc: In function 'int main()':
a.cc:7:22: error: 'll' was not declared in this scope
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^~
a.cc:16:5: note: in expansion of macro 'rep'
16 | rep(i,n){
| ^~~
a.cc:16:9: error: 'i' was not declared in this scope
16 | rep(i,n){
| ^
a.cc:7:29: note: in definition of macro 'rep'
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^
a.cc:7:22: error: 'll' was not declared in this scope
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^~
a.cc:21:7: note: in expansion of macro 'rep'
21 | rep(i,n){
| ^~~
a.cc:21:11: error: 'i' was not declared in this scope
21 | rep(i,n){
| ^
a.cc:7:29: note: in definition of macro 'rep'
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^
a.cc:24:24: error: 'i' was not declared in this scope
24 | int *s=new int[a[i]];
| ^
a.cc:7:22: error: 'll' was not declared in this scope
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^~
a.cc:25:7: note: in expansion of macro 'rep'
25 | rep(i,n)
| ^~~
a.cc:7:22: error: 'll' was not declared in this scope
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^~
a.cc:32:9: note: in expansion of macro 'rep'
32 | rep(i,n){
| ^~~
a.cc:7:22: error: 'll' was not declared in this scope
7 | #define rep(i,n) for(ll i=0;i<n;i++)
| ^~
a.cc:41:7: note: in expansion of macro 'rep'
41 | rep(i,n){
| ^~~
|
s441135611 | p00108 | C++ | #include <iostream>]
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <map>
using namespace std;
#define ll long long
#define rep(i,n) for(ll i=0;i<n;i++)
int main()
{
int n;
while(true){
cin>>n;
if(n==0){break;}
int *a=new int[n];
map<int,int>Map;
rep(i,n){
cin>>a[i];
}
for(int cnt=0;;cnt++)
{
rep(i,n){
Map[a[i]]++;
}
int *s=new int[a[i]];
rep(i,n)
{
s[i]=Map[a[i]];
}
if(a==s)
{
cout<<cnt<<endl;
rep(i,n){
if(i!=0){
cout<<" ";
}
cout<<a[i];
}
cout<<endl;
break;
}
rep(i,n){
s[i]=a[i];
}
}
}
return 0;
}
| a.cc:1:20: warning: extra tokens at end of #include directive
1 | #include <iostream>]
| ^
a.cc: In function 'int main()':
a.cc:25:24: error: 'i' was not declared in this scope
25 | int *s=new int[a[i]];
| ^
|
s882742604 | p00108 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main ( void )
{
int n; // ツ青板療アツづ個陳キツつウ
while ( cin >> n && n != 0 )
{
vector <int> S(n);
for ( int i = 0; i < n; i++ )
cin >> S[i];
vector <int> V(n);
vector <int> V_next(n);
V = S;
int cnt = 0;
while ( 1 )
{
for ( int i = 0; i < n; i++ )
{
V_next[i] = count( V.begin(), V.end(), V[i] );
}
cnt++;
if ( V == V_next )
{
cnt--;
break;
}
V = V_next;
}
cout << cnt << endl;
for ( int i = 0; i < n; i++ )
{
cout << V[i];
if ( i < n-1 )
cout << " ";
}
cout << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:23:45: error: 'count' was not declared in this scope; did you mean 'cnt'?
23 | V_next[i] = count( V.begin(), V.end(), V[i] );
| ^~~~~
| cnt
|
s206418072 | p00108 | C++ | #include <stdio.h>
#include <string.h>
void cpy(int src[],int dst[],int n){
for(int i=0;i<n;i++) dst[i]=src[i];
}
void OFA(int S[],int n){
int num[100];
memset(num,0,sizeof(num));
for(int i=0;i<n;i++) num[S[i]]++;
for(int i=0;i<n;i++) S[i]=num[S[i]];
}
bool check(int S[],int tmp[],int n){
for(int i=0;i<n;i++) if(S[i]!=tmp[i]) return false;
return true;
}
int main(){
int S[12],tmp[12],n,count;
while(1){
scanf("%d",&n);
if(!n) break;
count=-1;
for(int i=0;i<n;i++) scanf("%d",&S[i]);
cpy(S,tmp,n);
do{
cpy(tmp,S,n);
OFA(tmp,n);
//for(int i=0;i<n;i++) printf("%d ",tmp[i]);
count++;
}while(!check(S,tmp,n));
printf("%d\n",count);
for(int i=0;i<n-1;i++) printf("%d ",S[i]);
printf("%d\n",S[i]);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:33: error: 'i' was not declared in this scope
34 | printf("%d\n",S[i]);
| ^
|
s506450580 | p00108 | C++ | #include<algorithm>
#include<iostream>
#include<map>
int n;
int a[12], prv[12];
std::map<int, int> cnt, tmp;
int ans;
int main()
{
while( std::cin >> n, n )
{
ans = 0;
memset( a, 0, sizeof( a ) );
memset( prv, 0, sizeof( prv ) );
cnt.clear();
tmp.clear();
for( int i = 0; i != n; ++i )
{
std::cin >> a[i];
++cnt[a[i]];
}
while( true )
{
std::copy( a, a + 12, prv );
for( int i = 0; i != n; ++i )
{
a[i] = cnt[a[i]];
++tmp[a[i]];
}
if( std::equal( a, a + 12, prv ) )
break;
++ans;
cnt = tmp;
tmp.clear();
}
std::cout << ans << std::endl;
for( int i = 0; i != n; ++i )
std::cout << a[i] << ( i == n - 1 ? '\n' : ' ' );
}
return 0;
} | a.cc: In function 'int main()':
a.cc:15:17: error: 'memset' was not declared in this scope
15 | memset( a, 0, sizeof( a ) );
| ^~~~~~
a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<map>
+++ |+#include <cstring>
4 |
|
s025954344 | p00108 | C++ | #include<iostream>
int main(){
int n,ans=0,data[12],back[12];
while(std::cin>>n){
if(n==0)break;
for(int i=0;i<n;i++)std::cin>>data[i],back[i]=data[i];
while(true){
for(int i=0;i<n;i++){
int count=0;
for(int j=0;j<n;j++){
if(back[i]==back[j])count++;
}
data[i]=count;
}
bool f=true;
for(int i=0;i<n;i++){
if(data[i]!=back[i])f=false;
}
if(f)break;
memcpy(back,data,sizeof(data));
ans++;
}
std::cout<<ans<<std::endl;
for(int i=0;i<n;i++)std::cout<<data[i]<<" ";
std::cout<<std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:25: error: 'memcpy' was not declared in this scope
21 | memcpy(back,data,sizeof(data));
| ^~~~~~
a.cc:2:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 |
|
s838850172 | p00108 | C++ | #include<iostream>
int main(){
int n;
while(std::cin>>n){
int ans=0,data[12],back[12];
if(n==0)break;
for(int i=0;i<n;i++)std::cin>>data[i],back[i]=data[i];
while(true){
for(int i=0;i<n;i++){
int count=0;
for(int j=0;j<n;j++){
if(back[i]==back[j])count++;
}
data[i]=count;
}
bool f=true;
for(int i=0;i<n;i++){
if(data[i]!=back[i])f=false;
}
if(f)break;
for(int i=0;i<n;i++)back[i]=data[i];
ans++;
}
std::cout<<ans<<std::endl;
for(int i=0;i<n;i++){
if(i!=n-1)std::cout<<data[i]<<" ";
else std::cout<<data[i];
std::cout<<std::endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:2: error: expected '}' at end of input
32 | }
| ^
a.cc:3:11: note: to match this '{'
3 | int main(){
| ^
|
s012597717 | p00109 | Java | import java.util.Scanner;
public class SmartCalculator {
static String str;
static int pos;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
str = sc.next();
pos = 0;
System.out.println(expression());
}
sc.close();
}
static int expression() {
int ret = term();
while (pos < str.length()) {
if (str.charAt(pos) == '+') {
pos++;
ret += term();
} else if (str.charAt(pos) == '-') {
pos++;
ret -= term();
} else {
break;
}
}
return ret;
}
static int term() {
int ret = factor();
while (pos < str.length()) {
if (str.charAt(pos) == '*') {
pos++;
ret *= factor();
} else if (str.charAt(pos) == '/') {
pos++;
ret /= term();
} else {
break;
}
}
return ret;
}
static int factor() {
if (str.charAt(pos) == '(') {
pos++;
return expression();
} else {
return number();
}
}
static int number() {
int ret = 0;
while (Character.isDigit(str.charAt(pos))) {
ret *= 10;
ret += str.charAt(pos) - '0';
pos++;
}
return ret;
}
} | Main.java:3: error: class SmartCalculator is public, should be declared in a file named SmartCalculator.java
public class SmartCalculator {
^
1 error
|
s982949817 | p00109 | Java | import java.util.Scanner;
public class SmartCalculator {
static String str;
static int pos;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for (int i = 0; i < n; i++) {
str = sc.next();
pos = 0;
System.out.println(expression());
}
sc.close();
}
static int expression() {
int ret = term();
while (str.charAt(pos) != '=') {
if (str.charAt(pos) == '+') {
pos++;
ret += term();
} else if (str.charAt(pos) == '-') {
pos++;
ret -= term();
} else {
break;
}
}
return ret;
}
static int term() {
int ret = factor();
while (str.charAt(pos) != '=') {
if (str.charAt(pos) == '*') {
pos++;
ret *= factor();
} else if (str.charAt(pos) == '/') {
pos++;
ret /= term();
} else {
break;
}
}
return ret;
}
static int factor() {
if (str.charAt(pos) == '(') {
pos++;
int temp = expression();
pos++;
return temp;
} else {
return number();
}
}
static int number() {
int ret = 0;
while (Character.isDigit(str.charAt(pos))) {
ret *= 10;
ret += str.charAt(pos) - '0';
pos++;
}
return ret;
}
} | Main.java:3: error: class SmartCalculator is public, should be declared in a file named SmartCalculator.java
public class SmartCalculator {
^
1 error
|
s248209127 | p00109 | Java | def calc(array):
while not len(array) == 1:
if '*' in array:
x = array.index('*')
array[x + 1] = str(int(array[x - 1]) * int(array[x + 1]))
del array[x - 1:x + 1]
continue
if '/' in array:
x = array.index('/')
array[x + 1] = str(int(array[x - 1]) / int(array[x + 1]))
del array[x - 1:x + 1]
continue
if '-' in array:
x = array.index('-')
array[x + 1] = str(int(array[x - 1]) - int(array[x + 1]))
del array[x - 1:x + 1]
continue
if '+' in array:
x = array.index('+')
array[x + 1] = str(int(array[x - 1]) + int(array[x + 1]))
del array[x - 1:x + 1]
continue
return str(array[0])
n = input()
for i in xrange(n):
array = list(raw_input())
while '(' in array:
x1 = array.index('(') + 1
x2 = array.index(')')
jon = array[x1:x2]
array[x2] = calc(jon)
del array[x1 - 1:x2]
print calc(array[0:len(array) - 1]) | Main.java:1: error: unnamed classes are a preview feature and are disabled by default.
def calc(array):
^
(use --enable-preview to enable unnamed classes)
Main.java:1: error: <identifier> expected
def calc(array):
^
Main.java:1: error: ';' expected
def calc(array):
^
Main.java:5: error: class, interface, enum, or record expected
array[x + 1] = str(int(array[x - 1]) * int(array[x + 1]))
^
4 errors
|
s585135031 | p00109 | Java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;
import static java.lang.Integer.parseInt;
/**
* Smart Calculator
*/
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
String[] words;
//skip first line
br.readLine();
while ((line = br.readLine()) != null && !line.isEmpty()) {
Deque<String> queue = new ArrayDeque<>();
Deque<Character> stack = new ArrayDeque<>();
char _c = 0;
for (char c : line.toCharArray()) {
switch (c) {
case '+':
case '-':
if (!stack.isEmpty()) {
while (stack.peek() == '*' || stack.peek() == '/')){
queue.offer(String.valueOf(stack.pop()));
}
}
stack.push(c);
break;
case '*':
case '/':
case '(':
stack.push(c);
break;
case ')':
while (stack.peek() != '(') {
queue.offer(String.valueOf(stack.pop()));
}
stack.pop();
break;
case '=':
while (!stack.isEmpty()) {
queue.offer(String.valueOf(stack.pop()));
}
break;
default:
if ('0' <= _c && _c <= '9') {
String s = queue.pollLast();
queue.offer(s + c);
} else {
queue.offer(String.valueOf(c));
}
}
_c = c;
}
//solve
Deque<Integer> ans = new ArrayDeque<>();
for (String s : queue) {
if ("+-*/".indexOf(s) != -1) {
int a, b;
b = ans.pop();
a = ans.pop();
switch (s) {
case "+":
ans.push(a + b);
break;
case "-":
ans.push(a - b);
break;
case "*":
ans.push(a * b);
break;
case "/":
ans.push(a / b);
break;
}
} else {
ans.push(parseInt(s));
}
}
System.out.println(ans.peek());
}//end while
}//end main
} | Main.java:33: error: illegal start of expression
while (stack.peek() == '*' || stack.peek() == '/')){
^
1 error
|
s634664300 | p00109 | Java | import java.util.Scanner;
import java.util.function.IntBinaryOperator;
public class Calc {
static int lastIndexOf(String e, char ch) {
int nest = 0;
for(int i = e.length()-1; i > 0 ; i--) {
char c = e.charAt(i);
if(c == ‘(’) {
nest++;
}
if(c == ‘)’) {
nest--;
}
if(ch == c && nest == 0) {
return i;
}
}
return -1;
}
static int parse(String e) {
if(e.startsWith(“(”)) {
return parse(e.substring(1, e.length()-1));
}
int loc = lastIndexOf(e, ‘-’);
if(loc != -1) {
return parse(e.substring(0, loc)) - parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘+’);
if(loc != -1) {
return parse(e.substring(0, loc)) + parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘/’);
if(loc != -1) {
return parse(e.substring(0, loc)) / parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘*’);
if(loc != -1) {
return parse(e.substring(0, loc)) * parse(e.substring(loc+1));
}
return Integer.parseInt(e);
}
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
for(int i = 0; i < n; i++) {
String e = sc.next().replace(“=”, “”);
System.out.println(parse(e));
}
}
}
}
| Main.java:10: error: illegal character: '\u2018'
if(c == ?(?) {
^
Main.java:10: error: illegal character: '\u2019'
if(c == ?(?) {
^
Main.java:13: error: illegal character: '\u2018'
if(c == ?)?) {
^
Main.java:13: error: illegal character: '\u2019'
if(c == ?)?) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?)) {
^
Main.java:27: error: illegal character: '\u2018'
int loc = lastIndexOf(e, ?-?);
^
Main.java:27: error: illegal character: '\u2019'
int loc = lastIndexOf(e, ?-?);
^
Main.java:31: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?+?);
^
Main.java:31: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?+?);
^
Main.java:35: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?/?);
^
Main.java:35: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?/?);
^
Main.java:39: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?*?);
^
Main.java:39: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?*?);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
18 errors
|
s262750091 | p00109 | Java | import java.util.Scanner;
import java.util.function.IntBinaryOperator;
public class Calc {
static int lastIndexOf(String e, char ch) {
int nest = 0;
for(int i = e.length()-1; i > 0 ; i--) {
char c = e.charAt(i);
if(c == ‘(’) {
nest++;
}
if(c == ‘)’) {
nest--;
}
if(ch == c && nest == 0) {
return i;
}
}
return -1;
}
static int parse(String e) {
if(e.startsWith(“(”) && e.endsWith(“)”)) {
return parse(e.substring(1, e.length()-1));
}
int loc = lastIndexOf(e, ‘-’);
if(loc != -1) {
return parse(e.substring(0, loc)) - parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘+’);
if(loc != -1) {
return parse(e.substring(0, loc)) + parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘/’);
if(loc != -1) {
return parse(e.substring(0, loc)) / parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘*’);
if(loc != -1) {
return parse(e.substring(0, loc)) * parse(e.substring(loc+1));
}
return Integer.parseInt(e);
}
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
for(int i = 0; i < n; i++) {
String e = sc.next().replace(“=”, “”);
System.out.println(parse(e));
}
}
}
}
| Main.java:10: error: illegal character: '\u2018'
if(c == ?(?) {
^
Main.java:10: error: illegal character: '\u2019'
if(c == ?(?) {
^
Main.java:13: error: illegal character: '\u2018'
if(c == ?)?) {
^
Main.java:13: error: illegal character: '\u2019'
if(c == ?)?) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:27: error: illegal character: '\u2018'
int loc = lastIndexOf(e, ?-?);
^
Main.java:27: error: illegal character: '\u2019'
int loc = lastIndexOf(e, ?-?);
^
Main.java:31: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?+?);
^
Main.java:31: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?+?);
^
Main.java:35: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?/?);
^
Main.java:35: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?/?);
^
Main.java:39: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?*?);
^
Main.java:39: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?*?);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
20 errors
|
s528919221 | p00109 | Java | import java.util.Scanner;
import java.util.function.IntBinaryOperator;
public class Main {
static int lastIndexOf(String e, char ch) {
int nest = 0;
for(int i = e.length()-1; i > 0 ; i--) {
char c = e.charAt(i);
if(c == ‘(’) {
nest++;
}
if(c == ‘)’) {
nest--;
}
if(ch == c && nest == 0) {
return i;
}
}
return -1;
}
static int parse(String e) {
if(e.startsWith(“(”) && e.endsWith(“)”)) {
return parse(e.substring(1, e.length()-1));
}
int loc = lastIndexOf(e, ‘-’);
if(loc != -1) {
return parse(e.substring(0, loc)) - parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘+’);
if(loc != -1) {
return parse(e.substring(0, loc)) + parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘/’);
if(loc != -1) {
return parse(e.substring(0, loc)) / parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘*’);
if(loc != -1) {
return parse(e.substring(0, loc)) * parse(e.substring(loc+1));
}
return Integer.parseInt(e);
}
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
for(int i = 0; i < n; i++) {
String e = sc.next().replace(“=”, “”);
System.out.println(parse(e));
}
}
}
}
| Main.java:10: error: illegal character: '\u2018'
if(c == ?(?) {
^
Main.java:10: error: illegal character: '\u2019'
if(c == ?(?) {
^
Main.java:13: error: illegal character: '\u2018'
if(c == ?)?) {
^
Main.java:13: error: illegal character: '\u2019'
if(c == ?)?) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:27: error: illegal character: '\u2018'
int loc = lastIndexOf(e, ?-?);
^
Main.java:27: error: illegal character: '\u2019'
int loc = lastIndexOf(e, ?-?);
^
Main.java:31: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?+?);
^
Main.java:31: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?+?);
^
Main.java:35: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?/?);
^
Main.java:35: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?/?);
^
Main.java:39: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?*?);
^
Main.java:39: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?*?);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201c'
String e = sc.next().replace(?=?, ??);
^
Main.java:50: error: illegal character: '\u201d'
String e = sc.next().replace(?=?, ??);
^
20 errors
|
s999527101 | p00109 | Java | import java.util.Scanner;
import java.util.function.IntBinaryOperator;
public class Main{
static int lastIndexOf(String e, char ch) {
int nest = 0;
for(int i = e.length()-1; i > 0 ; i--) {
char c = e.charAt(i);
if(c == ‘(’) {
nest++;
}
if(c == ‘)’) {
nest--;
}
if(ch == c && nest == 0) {
return i;
}
}
return -1;
}
static int parse(String e) {
if(e.startsWith(“(”) && e.endsWith(“)”)) {
return parse(e.substring(1, e.length()-1));
}
int loc = lastIndexOf(e, ‘-’);
if(loc != -1) {
return parse(e.substring(0, loc)) - parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘+’);
if(loc != -1) {
return parse(e.substring(0, loc)) + parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘/’);
if(loc != -1) {
return parse(e.substring(0, loc)) / parse(e.substring(loc+1));
}
loc = lastIndexOf(e, ‘*’);
if(loc != -1) {
return parse(e.substring(0, loc)) * parse(e.substring(loc+1));
}
return Integer.parseInt(e);
}
public static void main(String[] args) {
try(Scanner sc = new Scanner(System.in)) {
int n = sc.nextInt();
for(int i = 0; i < n; i++) {
String e = str.substring(0,str.length()-1);
System.out.println(parse(e));
}
}
}
}
| Main.java:10: error: illegal character: '\u2018'
if(c == ?(?) {
^
Main.java:10: error: illegal character: '\u2019'
if(c == ?(?) {
^
Main.java:13: error: illegal character: '\u2018'
if(c == ?)?) {
^
Main.java:13: error: illegal character: '\u2019'
if(c == ?)?) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201c'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:24: error: illegal character: '\u201d'
if(e.startsWith(?(?) && e.endsWith(?)?)) {
^
Main.java:27: error: illegal character: '\u2018'
int loc = lastIndexOf(e, ?-?);
^
Main.java:27: error: illegal character: '\u2019'
int loc = lastIndexOf(e, ?-?);
^
Main.java:31: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?+?);
^
Main.java:31: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?+?);
^
Main.java:35: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?/?);
^
Main.java:35: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?/?);
^
Main.java:39: error: illegal character: '\u2018'
loc = lastIndexOf(e, ?*?);
^
Main.java:39: error: illegal character: '\u2019'
loc = lastIndexOf(e, ?*?);
^
16 errors
|
s528681363 | p00109 | Java | import javax.script.*;
public class EvalScript {
public static void main(String[] args) throws Exception {
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval("println('Hello JavaScript from Java.')");
engine.eval("var str1 = 'JavaScript String'");
engine.eval("println(str1);");
engine.eval("var str2 = new java.lang.String('Java String');");
engine.eval("println(str2);");
engine.eval("var array = ['JavaScript', 'Array'];");
engine.eval("println(array);");
engine.eval("var list = new java.util.ArrayList();");
engine.eval("list.add('Java');");
engine.eval("list.add('ArrayList');");
engine.eval("println(list);");
engine.eval("var obj = {'JavaScript':'Object'};");
engine.eval("println(obj);");
engine.eval("var map = new java.util.HashMap();");
engine.eval("map.put('Java', 'HashMap');");
engine.eval("println(map);");
Runtime r = Runtime.getRuntime();
engine.put("r", r);
engine.eval("print('Max: ' + r.maxMemory() + ' Bytes\\n');");
engine.eval("print('Total: ' + r.totalMemory() + ' Bytes\\n');");
engine.eval("print('Free: ' + r.freeMemory() + ' Bytes\\n');");
}
} | Main.java:3: error: class EvalScript is public, should be declared in a file named EvalScript.java
public class EvalScript {
^
1 error
|
s320054462 | p00109 | Java | import javax.script.*;
class Main{
public static void main(String[]z){
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("JavaScript");
engine.eval("println('Hello JavaScript from Java.')");
}
} | Main.java:7: error: unreported exception ScriptException; must be caught or declared to be thrown
engine.eval("println('Hello JavaScript from Java.')");
^
1 error
|
s985141824 | p00109 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int line=Integer.parseInt(br.readLine);
Main calc=new Main();
for(int n=0;n<line;n++){
String str=br.readLine();
Integer num=calc.doCalc(str.substring(0,str.length()));
if(num!=null){
System.out.println(num);
}
}
}
Integer doCalc(String expr){
return doCalc3(expr);
}
Integer doCalc3(String expr){
ArrayList<String> num=new ArrayList<String>();
int m=0;
while(m<expr.length()){
if(expr.indexOf("+",m)!=-1 && (expr.indexOf("-",m)==-1 || expr.indexOf("-",m)>expr.indexOf("+",m))){
if(expr.substring(0,expr.indexOf("+",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("+")));
num.add("+");
expr=expr.substring(expr.indexOf("+",m)+1);
}
else if(expr.substring(0,expr.indexOf("+",m)).indexOf(")")==-1){
m=expr.indexOf("+",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("+",m)));
num.add("+");
expr=expr.substring(expr.indexOf("+",m)+1);
}
}
else if(expr.indexOf("-",m)!=-1 && (expr.indexOf("+",m)==-1 || expr.indexOf("+",m)>expr.indexOf("-",m))){
if(expr.substring(0,expr.indexOf("-",m)).indexOf("(")==-1){
if(expr.indexOf("-",m)>m+1){
num.add(expr.substring(0, expr.indexOf("-")));
num.add("-");
expr=expr.substring(expr.indexOf("-",m)+1);
}
else{
m++;
}
}
else if(expr.substring(0,expr.indexOf("-",m)).indexOf(")")==-1){
m=expr.indexOf("-",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("-",m)));
num.add("-");
expr=expr.substring(expr.indexOf("-",m)+1);
}
}
else{
break;
}
}
num.add(expr);
Integer n=doCalc2(num.get(0));
m=1;
while(m<num.size()){
try {
if(num.get(m)=="+"){
n+=doCalc2(num.get(m+1));
}
else{
n-=doCalc2(num.get(m+1));
}
m+=2;
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
System.err.println(num.get(m)+"演算子の後には数字が来なくてはなりません。");
return null;
} catch (NullPointerException e){
return null;
}
}
return n;
}
Integer doCalc2(String expr){
ArrayList<String> num=new ArrayList<String>();
int m=0;
while(m<expr.length()){
if(expr.indexOf("*",m)!=-1 && (expr.indexOf("/",m)==-1 || expr.indexOf("/",m)>expr.indexOf("*",m))){
if(expr.substring(0,expr.indexOf("*",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("*")));
num.add("*");
expr=expr.substring(expr.indexOf("*",m)+1);
}
else if(expr.substring(0,expr.indexOf("*",m)).indexOf(")")==-1){
m=expr.indexOf("*",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("*",m)));
num.add("*");
expr=expr.substring(expr.indexOf("*",m)+1);
}
}
else if(expr.indexOf("/",m)!=-1 && (expr.indexOf("*",m)==-1 || expr.indexOf("*",m)>expr.indexOf("/",m))){
if(expr.substring(0,expr.indexOf("/",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("/")));
num.add("/");
expr=expr.substring(expr.indexOf("/",m)+1);
}
else if(expr.substring(0,expr.indexOf("/",m)).indexOf(")")==-1){
m=expr.indexOf("/",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("/",m)));
num.add("/");
expr=expr.substring(expr.indexOf("/",m)+1);
}
}
else{
break;
}
}
num.add(expr);
Integer n=doCalc1(num.get(0));
m=1;
while(m<num.size()){
try{
if(num.get(m)=="*"){
n*=doCalc1(num.get(m+1));
}
else{
n/=doCalc1(num.get(m+1));
}
m+=2;
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
System.err.println(num.get(m)+"演算子の後には数字が来なくてはなりません。");
return null;
} catch (NullPointerException e){
return null;
}
}
return n;
}
Integer doCalc1(String expr){
try{
if(expr.length()>6 && expr.substring(0, 6).equals("radius")){
return doCalc1(expr.substring(6))/180*Math.PI;
}
else if(expr.length()>3 && expr.substring(0, 3).equals("sin")){
return Math.sin(doCalc1(expr.substring(3)));
}
else if(expr.length()>3 && expr.substring(0, 3).equals("cos")){
return Math.cos(doCalc1(expr.substring(3)));
}
else if(expr.length()>3 && expr.substring(0, 3).equals("tan")){
return Math.tan(doCalc1(expr.substring(3)));
}
else if(expr.substring(0, 1).equals("r")){
return Math.sqrt(doCalc1(expr.substring(1)));
}
else{
return doCalc0(expr);
}
} catch (NullPointerException e){
return null;
}
}
Integer doCalc0(String expr){
if(expr.charAt(0)=='('){
if(expr.indexOf(")")!=-1){
return doCalc3(expr.substring(1,expr.indexOf(")")));
}
else{
System.err.println(")が見つかりません。:"+expr);
return null;
}
}
else{
if(expr.charAt(0)!=')'){
try {
return new Integer(expr);
} catch (NumberFormatException e) {
System.err.println("数字でないものが入力されています。:"+expr);
return null;
}
}
else{
System.err.println("(がありません。:"+expr);
return null;
}
}
}
} | Main.java:7: error: cannot find symbol
int line=Integer.parseInt(br.readLine);
^
symbol: variable readLine
location: variable br of type BufferedReader
Main.java:23: error: cannot find symbol
ArrayList<String> num=new ArrayList<String>();
^
symbol: class ArrayList
location: class Main
Main.java:23: error: cannot find symbol
ArrayList<String> num=new ArrayList<String>();
^
symbol: class ArrayList
location: class Main
Main.java:90: error: cannot find symbol
ArrayList<String> num=new ArrayList<String>();
^
symbol: class ArrayList
location: class Main
Main.java:90: error: cannot find symbol
ArrayList<String> num=new ArrayList<String>();
^
symbol: class ArrayList
location: class Main
Main.java:154: error: incompatible types: double cannot be converted to Integer
return doCalc1(expr.substring(6))/180*Math.PI;
^
Main.java:157: error: incompatible types: double cannot be converted to Integer
return Math.sin(doCalc1(expr.substring(3)));
^
Main.java:160: error: incompatible types: double cannot be converted to Integer
return Math.cos(doCalc1(expr.substring(3)));
^
Main.java:163: error: incompatible types: double cannot be converted to Integer
return Math.tan(doCalc1(expr.substring(3)));
^
Main.java:166: error: incompatible types: double cannot be converted to Integer
return Math.sqrt(doCalc1(expr.substring(1)));
^
Main.java:189: warning: [removal] Integer(String) in Integer has been deprecated and marked for removal
return new Integer(expr);
^
10 errors
1 warning
|
s758768808 | p00109 | Java | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Main {
public static void main(String args[] ) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int line=Integer.parseInt(br.readLine());
Main calc=new Main();
for(int n=0;n<line;n++){
String str=br.readLine();
Integer num=calc.doCalc(str.substring(0,str.length()));
if(num!=null){
System.out.println(num);
}
}
}
Integer doCalc(String expr){
return doCalc3(expr);
}
Integer doCalc3(String expr){
ArrayList<String> num=new ArrayList<String>();
int m=0;
while(m<expr.length()){
if(expr.indexOf("+",m)!=-1 && (expr.indexOf("-",m)==-1 || expr.indexOf("-",m)>expr.indexOf("+",m))){
if(expr.substring(0,expr.indexOf("+",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("+")));
num.add("+");
expr=expr.substring(expr.indexOf("+",m)+1);
}
else if(expr.substring(0,expr.indexOf("+",m)).indexOf(")")==-1){
m=expr.indexOf("+",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("+",m)));
num.add("+");
expr=expr.substring(expr.indexOf("+",m)+1);
}
}
else if(expr.indexOf("-",m)!=-1 && (expr.indexOf("+",m)==-1 || expr.indexOf("+",m)>expr.indexOf("-",m))){
if(expr.substring(0,expr.indexOf("-",m)).indexOf("(")==-1){
if(expr.indexOf("-",m)>m+1){
num.add(expr.substring(0, expr.indexOf("-")));
num.add("-");
expr=expr.substring(expr.indexOf("-",m)+1);
}
else{
m++;
}
}
else if(expr.substring(0,expr.indexOf("-",m)).indexOf(")")==-1){
m=expr.indexOf("-",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("-",m)));
num.add("-");
expr=expr.substring(expr.indexOf("-",m)+1);
}
}
else{
break;
}
}
num.add(expr);
Integer n=doCalc2(num.get(0));
m=1;
while(m<num.size()){
try {
if(num.get(m)=="+"){
n+=doCalc2(num.get(m+1));
}
else{
n-=doCalc2(num.get(m+1));
}
m+=2;
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
System.err.println(num.get(m)+"演算子の後には数字が来なくてはなりません。");
return null;
} catch (NullPointerException e){
return null;
}
}
return n;
}
Integer doCalc2(String expr){
ArrayList<String> num=new ArrayList<String>();
int m=0;
while(m<expr.length()){
if(expr.indexOf("*",m)!=-1 && (expr.indexOf("/",m)==-1 || expr.indexOf("/",m)>expr.indexOf("*",m))){
if(expr.substring(0,expr.indexOf("*",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("*")));
num.add("*");
expr=expr.substring(expr.indexOf("*",m)+1);
}
else if(expr.substring(0,expr.indexOf("*",m)).indexOf(")")==-1){
m=expr.indexOf("*",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("*",m)));
num.add("*");
expr=expr.substring(expr.indexOf("*",m)+1);
}
}
else if(expr.indexOf("/",m)!=-1 && (expr.indexOf("*",m)==-1 || expr.indexOf("*",m)>expr.indexOf("/",m))){
if(expr.substring(0,expr.indexOf("/",m)).indexOf("(")==-1){
num.add(expr.substring(0, expr.indexOf("/")));
num.add("/");
expr=expr.substring(expr.indexOf("/",m)+1);
}
else if(expr.substring(0,expr.indexOf("/",m)).indexOf(")")==-1){
m=expr.indexOf("/",m)+1;
}
else {
num.add(expr.substring(0, expr.indexOf("/",m)));
num.add("/");
expr=expr.substring(expr.indexOf("/",m)+1);
}
}
else{
break;
}
}
num.add(expr);
Integer n=doCalc1(num.get(0));
m=1;
while(m<num.size()){
try{
if(num.get(m)=="*"){
n*=doCalc1(num.get(m+1));
}
else{
n/=doCalc1(num.get(m+1));
}
m+=2;
} catch (IndexOutOfBoundsException e) {
e.printStackTrace();
System.err.println(num.get(m)+"演算子の後には数字が来なくてはなりません。");
return null;
} catch (NullPointerException e){
return null;
}
}
return n;
}
Integer doCalc1(String expr){
try{
if(expr.length()>6 && expr.substring(0, 6).equals("radius")){
return doCalc1(expr.substring(6))/180*Math.PI;
}
else if(expr.length()>3 && expr.substring(0, 3).equals("sin")){
return Math.sin(doCalc1(expr.substring(3)));
}
else if(expr.length()>3 && expr.substring(0, 3).equals("cos")){
return Math.cos(doCalc1(expr.substring(3)));
}
else if(expr.length()>3 && expr.substring(0, 3).equals("tan")){
return Math.tan(doCalc1(expr.substring(3)));
}
else if(expr.substring(0, 1).equals("r")){
return Math.sqrt(doCalc1(expr.substring(1)));
}
else{
return doCalc0(expr);
}
} catch (NullPointerException e){
return null;
}
}
Integer doCalc0(String expr){
if(expr.charAt(0)=='('){
if(expr.indexOf(")")!=-1){
return doCalc3(expr.substring(1,expr.indexOf(")")));
}
else{
System.err.println(")が見つかりません。:"+expr);
return null;
}
}
else{
if(expr.charAt(0)!=')'){
try {
return new Integer(expr);
} catch (NumberFormatException e) {
System.err.println("数字でないものが入力されています。:"+expr);
return null;
}
}
else{
System.err.println("(がありません。:"+expr);
return null;
}
}
}
} | Main.java:155: error: incompatible types: double cannot be converted to Integer
return doCalc1(expr.substring(6))/180*Math.PI;
^
Main.java:158: error: incompatible types: double cannot be converted to Integer
return Math.sin(doCalc1(expr.substring(3)));
^
Main.java:161: error: incompatible types: double cannot be converted to Integer
return Math.cos(doCalc1(expr.substring(3)));
^
Main.java:164: error: incompatible types: double cannot be converted to Integer
return Math.tan(doCalc1(expr.substring(3)));
^
Main.java:167: error: incompatible types: double cannot be converted to Integer
return Math.sqrt(doCalc1(expr.substring(1)));
^
Main.java:190: warning: [removal] Integer(String) in Integer has been deprecated and marked for removal
return new Integer(expr);
^
5 errors
1 warning
|
s528842065 | p00109 | Java | TERM_N = 0
TERM_OP_PM = 1
TERM_OP_MD = 2
TERM_OP_SIGN = 3
TERM_LB = 4
TERM_RB = 5
TERM_END = 6
def lex_analyze(str)
expr = []
come_sign = true
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
case t
when '+', '-'
if come_sign
expr.push [TERM_OP_SIGN, t]
else
expr.push [TERM_OP_PM, t]
come_sign = true
end
when '*', '/'
expr.push [TERM_OP_MD, t]
come_sign = true
when '('
expr.push [TERM_LB, t]
come_sign = true
when ')'
expr.push [TERM_RB, t]
come_sign = true
when '='
expr.push [TERM_END, t]
come_sign = true
else
expr.push [TERM_N, t.to_i]
come_sign = false
end
end
return expr
end
def to_rpn(expr)
rpn = []
stack = []
for t in expr
case t[0]
when TERM_N
rpn.push t
while ! stack.empty? && stack[-1][0] == TERM_OP_SIGN
rpn.push stack.pop
end
when TERM_OP_PM
while ! stack.empty? &&
((st = stack[-1])[0] == TERM_OP_PM || st[0] == TERM_OP_MD)
rpn.push stack.pop
end
stack.push t
when TERM_OP_MD
while ! stack.empty? && stack[-1][0] == TERM_OP_MD
rpn.push stack.pop
end
stack.push t
when TERM_OP_SIGN
stack.push t
when TERM_LB
stack.push t
when TERM_RB
while stack[-1][0] != TERM_LB
rpn.push stack.pop
end
stack.pop
while ! stack.empty? && stack[-1][0] == TERM_OP_SIGN
rpn.push stack.pop
end
when TERM_END
while ! stack.empty?
rpn.push stack.pop
end
end
end
return rpn
end
def calc_rpn(rpn)
stack = []
for t in rpn
if t[0] == TERM_N
stack.push t[1]
elsif t[0] == TERM_OP_SIGN
if t[1] == '-'
n1 = stack.pop
stack.push -n1
end
else
n2 = stack.pop
n1 = stack.pop
case t[1]
when "+"
stack.push(n1 + n2)
when "-"
stack.push(n1 - n2)
when "*"
stack.push(n1 * n2)
when "/"
stack.push(n1 / n2)
end
end
end
return stack[-1]
end
### main
n = gets.chomp.to_i
n.times.each do
str = gets.chomp
#p str
expr = lex_analyze(str)
#p expr
rpn = to_rpn(expr)
#p rpn
num = calc_rpn(rpn)
puts num
end | Main.java:1: error: class, interface, enum, or record expected
TERM_N = 0
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:14: error: illegal character: '\'
for t in str.scan(/\d+|[\+\-\*\/\(\)=]/)
^
Main.java:129: error: illegal character: '#'
### main
^
Main.java:129: error: illegal character: '#'
### main
^
Main.java:129: error: illegal character: '#'
### main
^
Main.java:135: error: illegal character: '#'
#p str
^
Main.java:137: error: illegal character: '#'
#p expr
^
Main.java:139: error: illegal character: '#'
#p rpn
^
14 errors
|
s415642054 | p00109 | C | #include <iostream>
#include <string>
using namespace std;
string s;
int single(int& pos);
int figure(int& pos);
int solve(int& pos);
int main(){
int T;
cin>>T;
for(int i = 0; i < T; i++){
cin>>s;
int pos = 0;
cout<<solve(pos)<<endl;
}
return 0;
}
int single(int& pos){//??°??????????????????????????¢??°
if(s[pos]!='('){
int res = 0;
while('0'<=s[pos] && s[pos]<='9'){
res *= 10;
res += s[pos]-48;
pos++;
}
return res;
}else{
return solve(++pos);
}
}
int figure(int& pos){//????????????????????????????????¢??°
int res = single(pos);
while(1){
if(s[pos]=='*'){
res *= single(++pos);
}else if(s[pos]=='/'){
res /= single(++pos);
}else {
return res;
}
}
}
int solve(int& pos){//?????¨???????¨????????????¢??°(????????????????¨?????????????????????¨?????????)
int res = figure(pos);
while(s[pos]!='=' && s[pos]!=')'){
if(s[pos]=='+') res += figure(++pos);
else if(s[pos]=='-') res -= figure(++pos);
}
pos++;
return res;
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s038516727 | p00109 | C | #include <iostream>
#include <string>
using namespace std;
int calc1();
int calc2();
int calc3();
int p;
string eq;
int calc1() {
int a = calc2();
while (eq[p]=='+' || eq[p]=='-') {
if (eq[p]=='+') {
p++;
a += calc2();
} else if (eq[p]=='-') {
p++;
a -= calc2();
}
}
return a;
}
int calc2() {
int a = calc3();
while (eq[p]=='*' || eq[p]=='/') {
if (eq[p]=='*') {
p++;
a *= calc3();
} else if (eq[p]=='/') {
p++;
a /= calc3();
}
}
return a;
}
int calc3() {
int a;
if (eq[p]=='(') {
p++;
a = calc1();
p++;
} else {
a = 0;
while (eq[p]>='0'&&eq[p]<='9') {
a *= 10;
a += eq[p++] - '0';
}
}
return a;
}
int main() {
int n, r;
cin >> n;
for (int i=0; i<n; i++) {
cin >> eq;
p = 0;
r = calc1();
cout << r << endl;
}
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s440587529 | p00109 | C | #include<iostream>
#include<string>
#include<sstream>
typedef std::stringstream sst;
int ToInt(std::string str){
int i;
sst ss;
ss<<str;
ss>>i;
return i;
}
std::string ToStr(int i){
std::string str;
sst ss;
ss<<i;
ss>>str;
return str;
}
std::string SubStr(std::string str,int x,int y){
return str.substr(x,y-x+1);
}
int Third(std::string str){
int fres,Ans;
while( ( fres=str.find_first_of("+-",1) ) != std::string::npos ){
int aRes;
if( (aRes=str.find_first_of("+-",fres+2)) == std::string::npos )
aRes=str.size()-1;
else --aRes;
if( str[fres] =='+' ){
Ans=ToInt(SubStr(str,0,fres-1))+ToInt(SubStr(str,fres+1,aRes));
str.replace(0,SubStr(str,0,aRes).size(),ToStr(Ans).c_str());
}else{
Ans=ToInt(SubStr(str,0,fres-1))-ToInt(SubStr(str,fres+1,aRes));
str.replace(0,SubStr(str,0,aRes).size(),ToStr(Ans).c_str());
}
}
return ToInt(str);
}
int Second(std::string str){
int fres,Ans;
while( ( fres=str.find_first_of("*/") ) != std::string::npos ){
int bRes,aRes;
if( (bRes=str.find_last_of("+-",fres)) == std::string::npos || bRes==0 )
bRes=0;
else ++bRes;
if( (aRes=str.find_first_of("+-*/",fres+2)) == std::string::npos )
aRes=str.size()-1;
else --aRes;
if( str[fres] =='*' ){
Ans=ToInt(SubStr(str,bRes,fres-1))*ToInt(SubStr(str,fres+1,aRes));
str.replace(bRes,SubStr(str,bRes,aRes).size(),ToStr(Ans).c_str());
}else{
Ans=ToInt(SubStr(str,bRes,fres-1))/ToInt(SubStr(str,fres+1,aRes));
str.replace(bRes,SubStr(str,bRes,aRes).size(),ToStr(Ans).c_str());
}
}
Ans=Third(str);
return Ans;
}
int First(std::string str){
int fres;
while( (fres = str.find(")") ) != std::string::npos ){
int rfres=str.rfind("(",fres);
std::string Next=SubStr(str,rfres+1,fres-1);
int cRes=Second(Next);
str.replace(rfres,Next.size()+2,ToStr(cRes).c_str());
}
int lRes = Second(str);
return lRes;
}
int main(){
int n;
std::string str;
std::cin>>n;
while( n-- ){
std::cin>>str;
std::cout<<First(str)<<std::endl;
}
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s256924474 | p00109 | C | #include <iostream>
#include <string>
using namespace std;
int calc1();
int calc2();
int calc3();
int p;
string eq;
int calc1() {
int a = calc2();
while (eq[p]=='+' || eq[p]=='-') {
if (eq[p]=='+') {
p++;
a += calc2();
} else if (eq[p]=='-') {
p++;
a -= calc2();
}
}
return a;
}
int calc2() {
int a = calc3();
while (eq[p]=='*' || eq[p]=='/') {
if (eq[p]=='*') {
p++;
a *= calc3();
} else if (eq[p]=='/') {
p++;
a /= calc3();
}
}
return a;
}
int calc3() {
int a;
if (eq[p]=='(') {
p++;
a = calc1();
p++;
} else {
a = 0;
while (eq[p]>='0'&&eq[p]<='9') {
a *= 10;
a += eq[p++] - '0';
}
}
return a;
}
int main() {
int n, r;
cin >> n;
for (int i=0; i<n; i++) {
cin >> eq;
p = 0;
r = calc1();
cout << r << endl;
}
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s835655295 | p00109 | C | #include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int i;
string str;
int Expression();
int Term();
int Factor();
int No(int);
int main(){
int n;
cin >> n;
while(n--){
cin >> str;
i = 0;
cout << Expression() << endl;
}
}
int Expression(){
int res = Term();
while(1){
switch(str[i]){
case '+':
i++;
res += Term();
break;
case '-':
i++;
res -= Term();
break;
default:
return res;
}
}
}
int Term(){
int res = Factor();
while(true){
switch(str[i]){
case '(':
i++;
res += Factor();
break;
case '*':
i++;
res *= Factor();
break;
case '/':
i++;
res /= Factor();
break;
default:
return res;
}
}
}
int Factor(){
int res = 0;
switch(str[i]){
case '(':
i++;
res = Expression();
i++;
return res;
default:
return No(i);
}
}
int No(int old){
while(isdigit(str[i])) i++;
return atoi((str.substr(old,i)).c_str());
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s448865560 | p00109 | C | #include<iostream>
#include<cstdlib>
#include<string>
using namespace std;
int i;
string str;
int Expression();
int Term();
int Factor();
int No(int);
int main(){
int n;
cin >> n;
while(n--){
cin >> str;
i = 0;
cout << Expression() << endl;
}
}
int Expression(){
int res = Term();
while(1){
switch(str[i]){
case '+':
i++;
res += Term();
break;
case '-':
i++;
res -= Term();
break;
default:
return res;
}
}
}
int Term(){
int res = Factor();
while(true){
switch(str[i]){
case '(':
i++;
res += Factor();
break;
case '*':
i++;
res *= Factor();
break;
case '/':
i++;
res /= Factor();
break;
default:
return res;
}
}
}
int Factor(){
int res = 0;
switch(str[i]){
case '(':
i++;
res = Expression();
i++;
return res;
default:
return No(i);
}
}
int No(int old){
while(isdigit(str[i])) i++;
return atoi((str.substr(old,i)).c_str());
} | main.c:1:9: fatal error: iostream: No such file or directory
1 | #include<iostream>
| ^~~~~~~~~~
compilation terminated.
|
s300694298 | p00109 | C | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
for i in l:
print i
| main.c:1:1: warning: data definition has no type or storage class
1 | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int]
main.c:1:3: error: expected expression before '[' token
1 | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
| ^
main.c:1:4: error: implicit declaration of function 'eval' [-Wimplicit-function-declaration]
1 | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
| ^~~~
main.c:1:9: error: implicit declaration of function 'raw_input' [-Wimplicit-function-declaration]
1 | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
| ^~~~~~~~~
main.c:1:26: error: expected ']' before 'for'
1 | l=[eval(raw_input()[:-1]) for i in range(int(input()))]
| ^~~~
| ]
main.c:2:1: error: expected ',' or ';' before 'for'
2 | for i in l:
| ^~~
|
s852514629 | p00109 | C | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}} | main.c:1:15: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^
main.c: In function 'M':
main.c:1:27: error: implicit declaration of function 'T' [-Wimplicit-function-declaration]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^
main.c:1:92: error: unknown type name 'elsereturn'
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~~~~~~
main.c: At top level:
main.c:1:107: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^
main.c: In function 'A':
main.c:1:184: error: unknown type name 'elsereturn'
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~~~~~~
main.c: At top level:
main.c:1:199: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^
main.c: In function 'T':
main.c:1:243: error: implicit declaration of function 'sscanf' [-Wimplicit-function-declaration]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'sscanf'
+++ |+#include <stdio.h>
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
main.c:1:243: warning: incompatible implicit declaration of built-in function 'sscanf' [-Wbuiltin-declaration-mismatch]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~~
main.c:1:243: note: include '<stdio.h>' or provide a declaration of 'sscanf'
main.c: At top level:
main.c:1:282: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~
main.c: In function 'main':
main.c:1:289: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~
main.c:1:289: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:289: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
main.c:1:289: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:336: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | char*p,E[200];M(){int r;r=T();for(;;){if(*p=='*'){p++;r*=T();}else if(*p=='/'){p++;r/=T();}elsereturn r;}}A(){int r;r=M();for(;;){if(*p=='+'){p++;r+=M();}else if(*p=='-'){p++;r-=M();}elsereturn r;}}T(){int r,l;if(*p=='('){p++;r=A();p++;}else{sscanf(p,"%d%n",&r,&l);p+=l;}return r;}main(){scanf("%*d\n");for(;~scanf("%[^=]=\n",E);){p=E;printf("%d\n",A());}}
| ^~~~~~
main.c:1:336: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:336: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:336: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s567570067 | p00109 | C | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));} | main.c:1:15: warning: data definition has no type or storage class
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^
main.c:1:15: error: type defaults to 'int' in declaration of 't' [-Wimplicit-int]
main.c:1:19: warning: data definition has no type or storage class
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^
main.c:1:19: error: type defaults to 'int' in declaration of 'f' [-Wimplicit-int]
main.c:1:23: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^
main.c: In function 'e':
main.c:1:23: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:1:81: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^
main.c: In function 't':
main.c:1:81: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c: At top level:
main.c:1:127: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^
main.c: In function 'f':
main.c:1:127: error: type of 'x' defaults to 'int' [-Wimplicit-int]
main.c:1:183: error: expected ':' before 'strtol'
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^~~~~~
| :
main.c: At top level:
main.c:1:199: error: return type defaults to 'int' [-Wimplicit-int]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^~~~
main.c: In function 'main':
main.c:1:199: error: type of 'i' defaults to 'int' [-Wimplicit-int]
main.c:1:213: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^~~~~
main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
+++ |+#include <stdio.h>
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
main.c:1:213: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^~~~~
main.c:1:213: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:1:235: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
1 | char*p,s[999];t();f();e(x){for(x=t(0);*p&&*p<46;)x+=*p++%5?t(0):-t(0);return x;}t(x){for(x=f(0);*p%5==2;x*=f(0))++p;return x;}f(x){return*p<41?++p,x=e(0),++p,x:*p<44?f(0):*p<46?-f(0)strtol(p,&p,0);}main(i){for(;~scanf("%s",p=s);)--i&&printf("%d\n",e(0));}
| ^~~~~~
main.c:1:235: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:1:235: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:1:235: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s796669036 | p00109 | C | i = 0
def number(begin):
global i
if begin[i] == "(":
i += 1
res = expression(begin)
i += 1
return res
res = 0
while begin[i].isdigit():
res *= 10
res += int(begin[i])
i+=1
return res
def term(begin):# your code goes here
global i
res = number(begin)
while True:
if begin[i] == "*":
i += 1
res *= number(begin)
elif begin[i] == "/":
i += 1
res /= number(begin)
else:
break
return res
def expression(begin):
global i
res = term(begin)
while True:
if begin[i] == "+":
i += 1
res += term(begin)
elif begin[i] == "-":
i += 1
res -= term(begin)
else:
break
return res
def main():
ex = raw_input() +"="
ans = expression(ex)
print ans
main() | main.c:1:1: warning: data definition has no type or storage class
1 | i = 0
| ^
main.c:1:1: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int]
main.c:3:1: error: expected ',' or ';' before 'def'
3 | def number(begin):
| ^~~
main.c:21:17: error: stray '#' in program
21 | def term(begin):# your code goes here
| ^
|
s794053730 | p00109 | C | #include <iostream>
#include <cctype>
using namespace std;
int expr(string& s,int& i);
int term(string& s,int& i);
int factor(string& s,int& i);
int number(string& s,int& i);
int expr(string& s,int& i){
int val = term(s,i);
while(s[i]=='+' || s[i]=='-'){
char op = s[i];
i++;
int val2 = term(s,i);
if(op=='+')val += val2;
else val -= val2;
}
return val;
}
int term(string& s,int& i){
int val = factor(s,i);
while(s[i]=='*' || s[i]=='/'){
char op = s[i];
i++;
int val2 = factor(s,i);
if(op=='*')val *= val2;
else val /= val2;
}
return val;
}
int factor(string& s,int& i){
if(isdigit(s[i]))return number(s,i);
i++;
int ret = expr(s,i);
i++;
return ret;
}
int number(string& s,int& i){
int n = s[i++] - '0';
while(isdigit(s[i])) n=n*10 + s[i++] - '0';
return n;
}
int main(void)
{
int n;
cin >> n;
for(int i=0;i<n;i++){
string str;
cin >> str;
int j=0;
cout << expr(str,j) << endl;
}
} | main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s476826520 | p00109 | C++ | n=int(input())
for i in range(n):
print(input())
| a.cc:1:1: error: 'n' does not name a type
1 | n=int(input())
| ^
|
s719213963 | p00109 | C++ | #include "pch.h"
#include <iostream>
#include <string>
#include <cctype>
#include <vector>
using namespace std;
inline bool is_op(string &in) {
if (in.size() == 1 && !isdigit(in[0]))
{
return true;
}
else
{
return false;
}
}
inline bool is_num(string &in)
{
for (auto i : in)
{
if (!isdigit(i))
return false;
}
return true;
}
inline bool is_expr(string &in)
{
if (!is_num(in) && !is_op(in)) { return true; }
else { return false; }
}
vector<string> split(string in)
{
vector<string> spl;
int pos = 0;
if (in[pos] == '-')
{
pos++;
while (pos < in.size()) {
if (isdigit(in[pos])) {
pos++;
}
else {
break;
}
}
spl.push_back(in.substr(0, pos));
in.erase(0, pos);
pos = 0;
}
while ( pos < in.size())
{
if (!isdigit(in[pos]))
{
if (pos != 0)
{
spl.push_back(in.substr(0, pos));
in.erase(0, pos);
pos = 0;
}
else
{
if (in[0] == '(')
{
int cnt = 1;
int r_pos = 1;
for (r_pos = 1; r_pos < in.size(); r_pos++)
{
if (in[r_pos] == '(')
cnt++;
if (in[r_pos] == ')')
cnt--;
if (cnt == 0)
break;
}
spl.push_back(in.substr(pos + 1, r_pos - 0 - 1));
in.erase(0, r_pos + 1);
pos = 0;
continue;
}
else if (in[0] == '+' || in[0] == '-' || in[0] == '*' || in[0] == '/')
{
spl.push_back(in.substr(0, 1));
in.erase(0, 1);
pos = 0;
}
}
}
else {
pos++;
}
}
if (in.size() != 0) spl.push_back(in);
return spl;
}
int cal(string &in_str) {
auto in = split(in_str);
while (in.size() != 1) {
auto pos = in.begin();
while (pos != in.end())
{
if (*pos == "*") {
pos--;
*pos = to_string(cal(*pos)*cal(*(pos + 2)));
in.erase(pos+1 , pos + 3);
}
else if (*pos == "/") {
pos--;
*pos = to_string(cal(*pos)/cal(*(pos + 2)));
in.erase(pos+1, pos + 3);
}
if (in.size()==1) break;
if (pos != in.end()) pos++;
}
pos = in.begin();
while (pos != in.end()) {
if (*pos == "+") {
pos--;
*pos = to_string(cal(*pos)+cal(*(pos + 2)));
in.erase(pos+1, pos + 3);
}
else if (*pos == "-") {
pos--;
*pos = to_string(cal(*pos) - cal(*(pos + 2)));
in.erase(pos+1, pos + 3);
}
if (in.size()==1) break;
if(pos != in.end()) pos++;
}
}
return(stoi(in[0]));
}
int main()
{
/*string tmp = "(-2*2)*5+(1+2)*(3+4)";
auto out=split(tmp);
for (auto i : out) {
cout << i << endl;
}
cout << cal(tmp) << endl;*/
string input;
int n;
cin >> n;
while (n--) {
cin >> input;
input.erase(input.end() - 1);
cout << cal(input) << endl;
}
return 0;
}
| a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s196138368 | p00109 | C++ | #include <iostream>
#include <cassert>
#include <cctype>
using namespace std;
string S;
size_t cur = 0;
int term();
int factor();
int expression();
int digit(){
assert(isdigit(S[cur]));
int n = S[cur] - '0';
cur = cur + 1;
return n;
}
int number(){
int n = digit();
while(cur<S.size() && isdigit(S[cur]))
n = n*10 + digit();
return n;
}
int expression(){
int a =term();
while (cur < S.size()) && (S[cur] == '+' || S[cur] == '-')){
char op = S[cur++];
int b = term();
if (op == '+') a += b;
else a -= b;
}
return a;
}
int term(){
int a =factor();
while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')){
char op = S[cur++];
int b = factor();
if (op == '*') a *= b; else a /= b;
}
return a;
}
int factor(){
if (S[cur] != '(') return number();
cur += 1;
int n = expression();
assert(S[cur] == ')');
cur +=1;
return n;
}
int main() {
int N;
cin >> N;
for (int i=0; i<N;++i){
cur = 0;
cin >> S;
S.resize(S.size()-1);
cout << expression() << endl;
}
return 0;
} | a.cc: In function 'int expression()':
a.cc:25:35: error: expected identifier before '(' token
25 | while (cur < S.size()) && (S[cur] == '+' || S[cur] == '-')){
| ^
|
s178294103 | p00109 | C++ | #include <cmath>
#include <cassert>
#include <iostream>
using namespace std;
string S;
size_t cur = 0;
int digit() {
int n;
assert(isdigit(S[cur]));
n = S[cur] -'0';
++cur;
return n;
}
int number() {
int n = digit();
while (cur < S.size() && isdigit(S[cur])) {
n = n*10 + digit();
}
return n;
}
int expression();
int factor() {
int n;
if (S[cur] != '(') n = number();
else {
++cur;
n = expression();
assert(S[cur] == ')');
}
return n;
}
int term() {
int t = factor();
while (cur < S.size() && (S[cur] == '*' || S[cur] == '/')) {
char op = S[cur++];
int b = factor();
if(op == '*') t *= b; else t = (int)trunk(1.0*t/b);
}
return t;
}
/*int expression() {
int sum = number();
while (S[cur] == '+' || S[cur] == '-') {
char op = S[cur++];
int b = number();
if(op == +) sum += b; else return sum -= b;
}
return sum;
}*/
int expression() {
int sum = term();
while (cur < S.size() && (S[cur] == '+' || S[cur] == '-')) {
char op = S[cur++];
int b = term();
if(op == '+') sum += b; else sum -= b;
}
return sum;
}
int main() {
int N;
cin >> N;
for (int i=0; i<N; ++i) {
cur = 0;
cin >> S;
S.resize(S.size()-1);
cout << expression() << endl;
}
return 0;
} | a.cc: In function 'int term()':
a.cc:43:53: error: 'trunk' was not declared in this scope; did you mean 'trunc'?
43 | if(op == '*') t *= b; else t = (int)trunk(1.0*t/b);
| ^~~~~
| trunc
|
s399349679 | p00109 | C++ | #include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
class ParseError{};
int number(State &begin) {
int ret = 0;
while (isdigit(*begin)) {
ret *= 10;
ret += *begin - '0';
begin++;
}
return ret;
}
int term(State &begin) {
int ret = number(begin);
for (;;) {
if (*begin == '*') {
begin++;
ret *= number(begin);
} else if (*begin == '/') {
begin++;
ret /= number(begin);
} else {
break;
}
}
return ret;
}
int expression(State &begin) {
int ret = term(begin);
for (;;) {
if (*begin == '+') {
begin++;
ret += term(begin);
} else if (*begin == '-') {
begin++;
ret -= term(begin);
} else {
break;
}
}
return ret;
}
int main(void){
int N;
cin >> N;
cin.ignore()
for (int i = 0; i < N; i++) {
string s;
getline(cin, s);
State begin = s.begin();
int ans = expression(begin);
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:61:17: error: expected ';' before 'for'
61 | cin.ignore()
| ^
| ;
62 | for (int i = 0; i < N; i++) {
| ~~~
a.cc:62:21: error: 'i' was not declared in this scope
62 | for (int i = 0; i < N; i++) {
| ^
|
s115493204 | p00109 | C++ | gets;$<.each_line.map{|s|p eval(s[0..-3])} | a.cc:1:35: error: too many decimal points in number
1 | gets;$<.each_line.map{|s|p eval(s[0..-3])}
| ^~~
a.cc:1:1: error: 'gets' does not name a type
1 | gets;$<.each_line.map{|s|p eval(s[0..-3])}
| ^~~~
a.cc:1:6: error: '$' does not name a type
1 | gets;$<.each_line.map{|s|p eval(s[0..-3])}
| ^
|
s480550309 | p00109 | C++ | #!/usr/bin/python3
import re
n = int(input())
for _ in range(n):
print(eval(re.sub(r'(\d+/\d+)', r'int(\1)', input()[0:-1]))) | a.cc:1:2: error: invalid preprocessing directive #!
1 | #!/usr/bin/python3
| ^
a.cc:6:24: warning: unknown escape sequence: '\d'
6 | print(eval(re.sub(r'(\d+/\d+)', r'int(\1)', input()[0:-1])))
| ^~~~~~~~~~~
a.cc:6:24: warning: unknown escape sequence: '\d'
a.cc:6:24: warning: multi-character literal with 7 characters exceeds 'int' size of 4 bytes
a.cc:6:38: warning: multi-character literal with 6 characters exceeds 'int' size of 4 bytes
6 | print(eval(re.sub(r'(\d+/\d+)', r'int(\1)', input()[0:-1])))
| ^~~~~~~~~
a.cc:3:1: error: 'import' does not name a type
3 | import re
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
|
s423787646 | p00109 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(5)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<short, short> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 114514810;
const int MOD = 100000007;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct edge
{
int from, to, cost;
bool operator < (const edge& e) const { return cost < e.cost; }
bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///
int calc(string s)
{
vi v;
REP(i, s.size())
{
if (s[i] == '+') v.push_back(0);
else if (s[i] == '-') v.push_back(1);
else if (s[i] == '*') v.push_back(2);
else if (s[i] == '/') v.push_back(3);
else
{
int tmp = s[i] - '0';
int t = i+1;
while (isdigit(s[t]))
{
tmp = tmp * 10 + s[t] - '0';
t++;
}
i = t - 1;
v.push_back(tmp);
}
}
while (v.size() > 1)
{
for (int i = 1; i < v.size();i+=2)
{
if (v[i]==2)
{
int tmp = v[i - 1] * v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
goto next;
}
else if (v[i] == 3)
{
int tmp = v[i - 1] / v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
goto next;
}
}
for (int i = 1; i < v.size(); i += 2)
{
if (v[i] == 0)
{
int tmp = v[i - 1] + v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
break;
}
else if (v[i] == 1)
{
int tmp = v[i - 1] - v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
break;
}
next:;
}
}
return v[0];
}
int solve(string s)
{
while (1)
{
if (find(ALL(s), '(') == s.end())
{
return calc(s);
}
else
{
string tmp;
REP(i, s.size())
{
if (s[i] != '(') tmp.push_back(s[i]);
else
{
int j;
for (j = s.size()-1;; j--)
{
if (s[j] == ')')
{
int t = solve(s.substr(i+1, j - i - 1));
tmp += to_string(t);
break;
}
}
i = j;
}
}
return solve(tmp);
}
}
return 0;
}
int main()
{
int sets;
string s;
cin >> sets;
REP(set, sets)
{
cin >> s;
s.pop_back();
cout << solve(s) << endl;
}
return 0;
} | a.cc: In function 'int calc(std::string)':
a.cc:89:17: error: jump to label 'next'
89 | next:;
| ^~~~
a.cc:68:38: note: from here
68 | goto next;
| ^~~~
a.cc:71:26: note: crosses initialization of 'int i'
71 | for (int i = 1; i < v.size(); i += 2)
| ^
a.cc:89:17: error: jump to label 'next'
89 | next:;
| ^~~~
a.cc:60:38: note: from here
60 | goto next;
| ^~~~
a.cc:71:26: note: crosses initialization of 'int i'
71 | for (int i = 1; i < v.size(); i += 2)
| ^
|
s934386416 | p00109 | C++ | #include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(5)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<short, short> P;
typedef complex<double> Point;
typedef long long ll;
const int INF = 114514810;
const int MOD = 100000007;
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct edge
{
int from, to, cost;
bool operator < (const edge& e) const { return cost < e.cost; }
bool operator >(const edge& e) const { return cost > e.cost; }
};
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///
int calc(string s)
{
vi v;
REP(i, s.size())
{
if (s[i] == '+') v.push_back(0);
else if (s[i] == '-') v.push_back(1);
else if (s[i] == '*') v.push_back(2);
else if (s[i] == '/') v.push_back(3);
else
{
int tmp = s[i] - '0';
int t = i+1;
while (isdigit(s[t]))
{
tmp = tmp * 10 + s[t] - '0';
t++;
}
i = t - 1;
v.push_back(tmp);
}
}
while (v.size() > 1)
{
for (int i = 1; i < v.size();i+=2)
{
if (v[i]==2)
{
int tmp = v[i - 1] * v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
goto next;
}
else if (v[i] == 3)
{
int tmp = v[i - 1] / v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
goto next;
}
}
for (int i = 1; i < v.size(); i += 2)
{
if (v[i] == 0)
{
int tmp = v[i - 1] + v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
break;
}
else if (v[i] == 1)
{
int tmp = v[i - 1] - v[i + 1];
v[i - 1] = tmp;
v.erase(v.begin() + i + 1);
v.erase(v.begin() + i);
break;
}
next:;
}
}
return v[0];
}
int solve(string s)
{
while (1)
{
if (find(ALL(s), '(') == s.end())
{
return calc(s);
}
else
{
string tmp;
REP(i, s.size())
{
if (s[i] != '(') tmp.push_back(s[i]);
else
{
int j;
for (j = s.size()-1;; j--)
{
if (s[j] == ')')
{
int t = solve(s.substr(i+1, j - i - 1));
tmp += to_string(t);
break;
}
}
i = j;
}
}
return solve(tmp);
}
}
return 0;
}
int main()
{
int sets;
string s;
cin >> sets;
REP(set, sets)
{
cin >> s;
s.erase(s.size() - 1);
cout << solve(s) << endl;
}
return 0;
} | a.cc: In function 'int calc(std::string)':
a.cc:89:17: error: jump to label 'next'
89 | next:;
| ^~~~
a.cc:68:38: note: from here
68 | goto next;
| ^~~~
a.cc:71:26: note: crosses initialization of 'int i'
71 | for (int i = 1; i < v.size(); i += 2)
| ^
a.cc:89:17: error: jump to label 'next'
89 | next:;
| ^~~~
a.cc:60:38: note: from here
60 | goto next;
| ^~~~
a.cc:71:26: note: crosses initialization of 'int i'
71 | for (int i = 1; i < v.size(); i += 2)
| ^
|
s589288081 | p00109 | C++ | #include <bits/stdc++.h>
using namespace std;
const int dx[]={0,1,0,-1,1,-1,-1,1};
const int dy[]={-1,0,1,0,1,1,-1,-1};
const int INF = 1<<30;
const double EPS = 1e-8;
#define PB push_back
#define mk make_pair
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
string s;
int index;
int number();
int factor();
int term();
int expr();
int number(){
int n = s[index] - '0';
index++;
while(isdigit(s[index])){
n = n*10 + s[index] - '0';
index++;
}
return n;
}
int factor(){
if(isdigit(s[index])) return number();
index++;
int ret = expr();
index++;
return ret;
}
int term(){
int val = factor();
while(s[index] == '*' || s[index] == '/'){
char op = s[index];
index++;
int tmp = factor();
if(op == '*') val *= tmp;
else val /= tmp;
}
return val;
}
int expr(){
int val = term();
while(s[index] == '+' || s[index] == '-'){
char op = s[index];
index++;
int tmp = term();
if(op == '+')val += tmp;
else val -= tmp;
}
return val;
}
int main(){
int N;
cin >> N;
while(N--){
index = 0;
cin >> s;
s.resize(s.size()-1);
cout << expr() << "\n";
}
return 0;
} | a.cc:19:5: error: 'int index' redeclared as different kind of entity
19 | int index;
| ^~~~~
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:121,
from a.cc:1:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'int number()':
a.cc:25:14: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
25 | int n = s[index] - '0';
| ^
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:
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
1265 | operator[](size_type __pos)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1265 | operator[](size_type __pos)
| ~~~~~~~~~~^~~~~
a.cc:26:10: error: no post-increment operator for type
26 | index++;
| ^~
a.cc:27:20: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
27 | while(isdigit(s[index])){
| ^
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
1265 | operator[](size_type __pos)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1265 | operator[](size_type __pos)
| ~~~~~~~~~~^~~~~
a.cc:28:21: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
28 | n = n*10 + s[index] - '0';
| ^
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
1265 | operator[](size_type __pos)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1265 | operator[](size_type __pos)
| ~~~~~~~~~~^~~~~
a.cc:29:14: error: no post-increment operator for type
29 | index++;
| ^~
a.cc: In function 'int factor()':
a.cc:34:17: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
34 | if(isdigit(s[index])) return number();
| ^
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
1265 | operator[](size_type __pos)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1265 | operator[](size_type __pos)
| ~~~~~~~~~~^~~~~
a.cc:35:10: error: no post-increment operator for type
35 | index++;
| ^~
a.cc:37:10: error: no post-increment operator for type
37 | index++;
| ^~
a.cc: In function 'int term()':
a.cc:42:12: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
42 | while(s[index] == '*' || s[index] == '/'){
| ^
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; const_reference = const char&; size_type = long unsigned int]'
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1247:29: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1247 | operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/basic_string.h:1265:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&; size_type = long unsigned int]'
1265 | operator[](size_type __pos)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:1265:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
1265 | operator[](size_type __pos)
| ~~~~~~~~~~^~~~~
a.cc:42:31: error: no match for 'operator[]' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and '<unresolved overloaded function type>')
42 | while(s[index] == '*' || s[index] == '/'){
| ^
/usr/include/c++/14/bits/basic_string.h:1247:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::const_reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator[](size_type) const [with _CharT = char; _Traits |
s452480671 | p00109 | C++ | //?????????
//??????00-440415D???Smart_Calculator.cpp
#include <iostream>
#include <string>
#include <cassert>
#include <cctype>
#include <stdio.h>
using namespace std;
string S = "1+2*(3+4)";
size_t cur = 0;
int expression();
int digit(){
assert(isdigit(S[cur]));
int n = S[cur++]-'0';
return n;
}
int number(){
int n = digit();
while(cur<S.size() && isdigit(S[cur])){
n = n*10 + digit();
}
return n;
}
int factor(){
if(S[cur] != '('){
return number();
}else{
cur++;
int n = expression();
assert(S[cur])==')');
cur++;
return n;
}
}
//??????????????????????????????
int term(){
int a = factor();
while(cur < S.size() && (S[cur] == '*' || S[cur] == '/')){
char op = S[cur++];
int b = factor();
if(op == '*'){
a *= b;
}else if(op == '/'){
a /= b;
}
}
return a;
}
int expression(){
int sum = term();
while(S[cur] == '+' || S[cur] == '-'){
char op = S[cur++];
int b = term();
if(op == '+'){
sum += b;
}else if(op == '-'){
sum -= b;
}
}
return sum;
}
int main(){
int N;
cin >> N;
for(int i=0; i<N; i++){
cur = 0;
cin >> S;
S.resize(S.size-1);
cout << expression() << endl;
}
return 0;
} | a.cc: In function 'int factor()':
a.cc:37:31: error: invalid operands of types 'void' and 'char' to binary 'operator=='
37 | assert(S[cur])==')');
| ^~~~~
| |
| char
a.cc: In function 'int main()':
a.cc:78:28: error: invalid use of member function 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size_type std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::size() const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]' (did you forget the '()' ?)
78 | S.resize(S.size-1);
| ~~^~~~
| ()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.