p_id
stringlengths
6
6
language
stringclasses
10 values
status
stringclasses
2 values
code
stringlengths
1
563k
prompt
stringlengths
113
563k
answer
stringclasses
2 values
p00000
C
Compile Error
#include <stdio.h> int main(void){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(void){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> using namespace std; int main() { int a,b,c,d; a = 1; b = 1; d = 1; do { c = a*b; cout << a << "x" << b << "=" << c << "\n\n"; b++; if (b == 11) { b = 1; a++; } d++; } while (d <= 100); }
Here is a piece of code written in C: #include <iostream> using namespace std; int main() { int a,b,c,d; a = 1; b = 1; d = 1; do { c = a*b; cout << a << "x" << b << "=" << c << "\n\n"; b++; if (b == 11) { b = 1; a++; } d++; } while (d <= 100); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> using namespace std; int main() { int a,b,c,d; a = 1; b = 1; d = 1; do { c = a*b; cout << a << "x" << b << "=" << c << "\n"; b++; if (b == 11) { b = 1; a++; } d++; } while (d <= 100); }
Here is a piece of code written in C: #include <iostream> using namespace std; int main() { int a,b,c,d; a = 1; b = 1; d = 1; do { c = a*b; cout << a << "x" << b << "=" << c << "\n"; b++; if (b == 11) { b = 1; a++; } d++; } while (d <= 100); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main() { int i; for(i=1;i<=9;i++) { printf("%dx%d=%d\n,i,i,i*i); } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main() { int i; for(i=1;i<=9;i++) { printf("%dx%d=%d\n,i,i,i*i); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void) { int i; int j; for(i = 1; i < 10; i++) { for(j = 1; j < 10; j++) { print("%d x %d = %d", i, j, i*j); } } }
Here is a piece of code written in C: #include <stdio.h> int main(void) { int i; int j; for(i = 1; i < 10; i++) { for(j = 1; j < 10; j++) { print("%d x %d = %d", i, j, i*j); } } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main() { for(int i=1; i<10; i++) for(int j=1; j<10 ; j++) printf("%dx%d=%d\n",i,j,i*j); return 0; }
Here is a piece of code written in C: #include<stdio.h> int main() { for(int i=1; i<10; i++) for(int j=1; j<10 ; j++) printf("%dx%d=%d\n",i,j,i*j); return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <vector> using namespace std; const double eps=1e-8; int dcmp(double x) { if(fabs(x)<eps) return 0; else return x<0?-1:1; } struct point { double x,y; point(double x=0,double y=0):x(x),y(y){} }; point operator+(point a,point b){return point(a.x+b.x,a.y+b.y);} point operator-(point a,point b){return point(a.x-b.x,a.y-b.y);} point operator*(point a,double p){return point(a.x*p,a.y*p);} bool operator==(point a,point b) { return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y)==0; } double dot(point a,point b){return a.x*b.x+a.y*b.y;} double length(point a){return sqrt(dot(a,a));} double cross(point a,point b){return a.x*b.y-a.y*b.x;} point normal(point a) { double L=length(a); return point(-a.y/L,a.x/L); } point getlineinter(point p,point v,point q,point w) { point u=p-q; double t=cross(w,u)/cross(v,w); return p+v*t; } struct circle { point c; double r; circle(point c=point(0,0),double r=0):c(c),r(r){} point getpoint(double a) { return point(c.x+cos(a)*r,c.y+sin(a)*r); } }; double angle(point v){return atan2(v.y,v.x);} int getlinecircleinter(point p,point v,circle C,double& t1,double& t2,vector<point>& sol) { double a=v.x,b=p.x-C.c.x,c=v.y,d=p.y-C.c.y; double e=a*a+c*c,f=2*(a*b+c*d),g=b*b+d*d-C.r*C.r; double delta=f*f-4*e*g; if(dcmp(delta)<0) return 0; if(dcmp(delta)==0) { t1=t2=-f/(2*e); sol.push_back(p+v*t1); return 1; } t1=(-f-sqrt(delta))/(2*e);sol.push_back(p+v*t1); t2=(-f+sqrt(delta))/(2*e);sol.push_back(p+v*t2); return 2; } int getcircleinter(circle C1,circle C2,vector<point>& sol) { double d=length(C1.c-C2.c); if(dcmp(d)==0) { if(dcmp(C1.r-C2.r)==0) return -1; return 0; } if(dcmp(C1.r+C2.r-d)<0) return 0; if(dcmp(fabs(C1.r-C2.r)-d)>0) return 0; double a=angle(C2.c-C1.c); double da=acos((C1.r*C1.r+d*d-C2.r*C2.r)/(2*C1.r*d)); point p1=C1.getpoint(a-da),p2=C1.getpoint(a+da); sol.push_back(p1); if(p1==p2) return 1; sol.push_back(p2); return 2; } int get(double r1,double r2,double x1,double x2,double y1,double y2,circle& CC) { double A=(2*x1*r2*r2-2*x2*r1*r1)/(r2*r2-r1*r1); double B=(2*y1*r2*r2-2*y2*r1*r1)/(r2*r2-r1*r1); double C=(r2*r2*(x1*x1+y1*y1)-r1*r1*(x2*x2+y2*y2))/(r2*r2-r1*r1); double D=A*A/4+B*B/4-C; if(dcmp(D)<0) return 0; CC.c.x=A/2;CC.c.y=B/2; CC.r=sqrt(D); return 1; } int main() { int r[3],x[3],y[3]; point p[3]; vector<point> sol; for(int i=0;i<3;i++) { scanf("%d%d%d",&x[i],&y[i],&r[i]); p[i]=point(x[i],y[i]); } if(r[0]==r[1] && r[1]==r[2]) { point v1=p[0]-p[1],v2=p[1]-p[2]; point n1=normal(v1),n2=normal(v2); point m1=(p[0]+p[1])*0.5,m2=(p[1]+p[2])*0.5; point ans=getlineinter(m1,n1,m2,n2); printf("%.5f %.5f\n",ans.x,ans.y); } else if(r[0]==r[1]) { circle C; if(get(r[0],r[2],x[0],x[2],y[0],y[2],C)) { point v=p[0]-p[1]; point n=normal(v); point m=(p[0]+p[1])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else if(r[0]==r[2]) { circle C; if(get(r[0],r[1],x[0],x[1],y[0],y[1],C)) { point v=p[0]-p[2]; point n=normal(v); point m=(p[0]+p[2])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else if(r[1]==r[2]) { circle C; if(get(r[0],r[2],x[0],x[2],y[0],y[2],C)) { point v=p[2]-p[1]; point n=normal(v); point m=(p[2]+p[1])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else { circle C1,C2; if(get(r[0],r[1],x[0],x[1],y[0],y[1],C1) && get(r[0],r[2],x[0],x[2],y[0],y[2],C2)) { getcircleinter(C1,C2,sol); double maxangle=0; int ans=-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } return 0; }
Here is a piece of code written in C: #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <vector> using namespace std; const double eps=1e-8; int dcmp(double x) { if(fabs(x)<eps) return 0; else return x<0?-1:1; } struct point { double x,y; point(double x=0,double y=0):x(x),y(y){} }; point operator+(point a,point b){return point(a.x+b.x,a.y+b.y);} point operator-(point a,point b){return point(a.x-b.x,a.y-b.y);} point operator*(point a,double p){return point(a.x*p,a.y*p);} bool operator==(point a,point b) { return dcmp(a.x-b.x)==0 && dcmp(a.y-b.y)==0; } double dot(point a,point b){return a.x*b.x+a.y*b.y;} double length(point a){return sqrt(dot(a,a));} double cross(point a,point b){return a.x*b.y-a.y*b.x;} point normal(point a) { double L=length(a); return point(-a.y/L,a.x/L); } point getlineinter(point p,point v,point q,point w) { point u=p-q; double t=cross(w,u)/cross(v,w); return p+v*t; } struct circle { point c; double r; circle(point c=point(0,0),double r=0):c(c),r(r){} point getpoint(double a) { return point(c.x+cos(a)*r,c.y+sin(a)*r); } }; double angle(point v){return atan2(v.y,v.x);} int getlinecircleinter(point p,point v,circle C,double& t1,double& t2,vector<point>& sol) { double a=v.x,b=p.x-C.c.x,c=v.y,d=p.y-C.c.y; double e=a*a+c*c,f=2*(a*b+c*d),g=b*b+d*d-C.r*C.r; double delta=f*f-4*e*g; if(dcmp(delta)<0) return 0; if(dcmp(delta)==0) { t1=t2=-f/(2*e); sol.push_back(p+v*t1); return 1; } t1=(-f-sqrt(delta))/(2*e);sol.push_back(p+v*t1); t2=(-f+sqrt(delta))/(2*e);sol.push_back(p+v*t2); return 2; } int getcircleinter(circle C1,circle C2,vector<point>& sol) { double d=length(C1.c-C2.c); if(dcmp(d)==0) { if(dcmp(C1.r-C2.r)==0) return -1; return 0; } if(dcmp(C1.r+C2.r-d)<0) return 0; if(dcmp(fabs(C1.r-C2.r)-d)>0) return 0; double a=angle(C2.c-C1.c); double da=acos((C1.r*C1.r+d*d-C2.r*C2.r)/(2*C1.r*d)); point p1=C1.getpoint(a-da),p2=C1.getpoint(a+da); sol.push_back(p1); if(p1==p2) return 1; sol.push_back(p2); return 2; } int get(double r1,double r2,double x1,double x2,double y1,double y2,circle& CC) { double A=(2*x1*r2*r2-2*x2*r1*r1)/(r2*r2-r1*r1); double B=(2*y1*r2*r2-2*y2*r1*r1)/(r2*r2-r1*r1); double C=(r2*r2*(x1*x1+y1*y1)-r1*r1*(x2*x2+y2*y2))/(r2*r2-r1*r1); double D=A*A/4+B*B/4-C; if(dcmp(D)<0) return 0; CC.c.x=A/2;CC.c.y=B/2; CC.r=sqrt(D); return 1; } int main() { int r[3],x[3],y[3]; point p[3]; vector<point> sol; for(int i=0;i<3;i++) { scanf("%d%d%d",&x[i],&y[i],&r[i]); p[i]=point(x[i],y[i]); } if(r[0]==r[1] && r[1]==r[2]) { point v1=p[0]-p[1],v2=p[1]-p[2]; point n1=normal(v1),n2=normal(v2); point m1=(p[0]+p[1])*0.5,m2=(p[1]+p[2])*0.5; point ans=getlineinter(m1,n1,m2,n2); printf("%.5f %.5f\n",ans.x,ans.y); } else if(r[0]==r[1]) { circle C; if(get(r[0],r[2],x[0],x[2],y[0],y[2],C)) { point v=p[0]-p[1]; point n=normal(v); point m=(p[0]+p[1])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else if(r[0]==r[2]) { circle C; if(get(r[0],r[1],x[0],x[1],y[0],y[1],C)) { point v=p[0]-p[2]; point n=normal(v); point m=(p[0]+p[2])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else if(r[1]==r[2]) { circle C; if(get(r[0],r[2],x[0],x[2],y[0],y[2],C)) { point v=p[2]-p[1]; point n=normal(v); point m=(p[2]+p[1])*0.5; double t1,t2; getlinecircleinter(m,n,C,t1,t2,sol); double maxangle=0; int ans =-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } else { circle C1,C2; if(get(r[0],r[1],x[0],x[1],y[0],y[1],C1) && get(r[0],r[2],x[0],x[2],y[0],y[2],C2)) { getcircleinter(C1,C2,sol); double maxangle=0; int ans=-1; for(int i=0;i<sol.size();i++) { point P=sol[i]-r[0]; double tmp=r[0]/length(P); double ang=2*asin(tmp); if(dcmp(maxangle-ang)<0) { maxangle=ang; ans=i; } } if(ans!=-1) printf("%.5f %.5f\n",sol[ans].x,sol[ans].y); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
print("1x1=1")
Here is a piece of code written in C: print("1x1=1") Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
test
Here is a piece of code written in C: test Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #include<conio.h> int main(void){ int a=1; int i,j; for( i=1;i<10;i++){ for(j=1;j<10;j++){ printf("%d * %d= %d \n",i,j,i*j); } } getch(); return 0; }
Here is a piece of code written in C: #include<stdio.h> #include<conio.h> int main(void){ int a=1; int i,j; for( i=1;i<10;i++){ for(j=1;j<10;j++){ printf("%d * %d= %d \n",i,j,i*j); } } getch(); return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <queue> #include <vector> #include <cstring> #include <iostream> #include <map> #define pb push_back #define mp make_pair using namespace std; typedef vector<pair<int,int> >::iterator IT; const int N = 30005; int sz[N], fr[N], f[N], dis[N]; int opt[N]; bool vis[N]; bool del[N]; vector<int> all; vector<pair<int,int> > inf, vv[N], vec[N]; void calc(int u, int par){ all.pb(u); sz[u] = 1; opt[u] = 0; for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first] && e->first != par){ calc(e->first, u); sz[u] += sz[e->first]; opt[u] = max(opt[u], sz[e->first]); } } } int Center(int u){ all.clear(); calc(u, -1); int n = all.size(), mx = 1e9; for(vector<int>::iterator e = all.begin(); e != all.end(); ++e){ opt[*e] = max(opt[*e], n-sz[*e]); if(opt[*e] < mx){ mx = opt[*e]; u = *e; } } return u; } void go(int u, int par, int dep, int len){ if(dep > inf.size()) inf.pb(mp(len,1)); else{ if(len > inf[dep-1].first) inf[dep-1] = mp(len, 1); else if(len == inf[dep-1].first) inf[dep-1].second++; } for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first] && e->first != par){ go(e->first, u, dep+1, len+e->second); } } } pair<int,int> M[N]; int k, ans, ansc; void dfs(int u){ u = Center(u); //M.clear(); for(int i=0;i<=all.size();++i) M[i]=mp(0,0); for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first]){ inf.clear(); go(e->first, u, 1, e->second); for(int p = 0; p < inf.size(); ++p){ if(M[k-1-p].first){ if(M[k-1-p].first + inf[p].first > ans){ ans = M[k-1-p].first + inf[p].first; ansc = M[k-1-p].second*inf[p].second; } else if(M[k-1-p].first+inf[p].first == ans){ ansc += M[k-1-p].second*inf[p].second; } } } for(int p = 0; p < inf.size(); ++p){ if(inf[p].first == M[p+1].first) M[p+1].second += inf[p].second; else if(inf[p].first > M[p+1].first) M[p+1] = inf[p]; } } } if(M[k].first > ans){ ans = M[k].first; ansc = M[k].second; } else if(M[k].first == ans){ ansc += M[k].second; } del[u] = true; for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first]) dfs(e->second); } } void build(){ queue<int> q; q.push(1); memset(vis,0,sizeof(vis)); memset(dis,0x1f,sizeof(dis)); dis[1] = 0; while(!q.empty()){ int u = q.front(); q.pop(); vis[u] = 0; for(IT e = vv[u].begin(); e != vv[u].end(); ++e){ if(dis[u]+e->second < dis[e->first] || (dis[u]+e->second == dis[e->first] && u < f[e->first])){ dis[e->first] = dis[u] + e->second; f[e->first] = u; fr[e->first] = e->second; if(!vis[e->first]){ vis[e->first] = true; q.push(e->first); } } } } } void build(){ priority_queue<pair<int,int> > q; q.push(mp(0, 1)); memset(vis,0,sizeof(vis)); memset(dis,0x1f,sizeof(dis)); dis[1] = 0; while(!q.empty()){ } } int main(){ int tt, n, m, i, a, b, c; scanf("%d",&tt); while(tt--){ memset(del,0,sizeof(del)); scanf("%d%d%d",&n,&m,&k); k--; for(i=1;i<=n;++i) vv[i].clear(), vec[i].clear(); for(i=1;i<=n;++i){ scanf("%d%d%d",&a,&b,&c); vv[a].pb(mp(b, c)); vv[b].pb(mp(a, c)); } build(); for(i=2;i<=n;++i){ vec[f[i]].pb(mp(i, fr[i])); vec[i].pb(mp(f[i], fr[i])); } ans = 0; dfs(1); printf("%d %d\n", ans, ansc); } return 0; }
Here is a piece of code written in C: #pragma comment(linker, "/STACK:102400000,102400000") #include <cstdio> #include <queue> #include <vector> #include <cstring> #include <iostream> #include <map> #define pb push_back #define mp make_pair using namespace std; typedef vector<pair<int,int> >::iterator IT; const int N = 30005; int sz[N], fr[N], f[N], dis[N]; int opt[N]; bool vis[N]; bool del[N]; vector<int> all; vector<pair<int,int> > inf, vv[N], vec[N]; void calc(int u, int par){ all.pb(u); sz[u] = 1; opt[u] = 0; for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first] && e->first != par){ calc(e->first, u); sz[u] += sz[e->first]; opt[u] = max(opt[u], sz[e->first]); } } } int Center(int u){ all.clear(); calc(u, -1); int n = all.size(), mx = 1e9; for(vector<int>::iterator e = all.begin(); e != all.end(); ++e){ opt[*e] = max(opt[*e], n-sz[*e]); if(opt[*e] < mx){ mx = opt[*e]; u = *e; } } return u; } void go(int u, int par, int dep, int len){ if(dep > inf.size()) inf.pb(mp(len,1)); else{ if(len > inf[dep-1].first) inf[dep-1] = mp(len, 1); else if(len == inf[dep-1].first) inf[dep-1].second++; } for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first] && e->first != par){ go(e->first, u, dep+1, len+e->second); } } } pair<int,int> M[N]; int k, ans, ansc; void dfs(int u){ u = Center(u); //M.clear(); for(int i=0;i<=all.size();++i) M[i]=mp(0,0); for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first]){ inf.clear(); go(e->first, u, 1, e->second); for(int p = 0; p < inf.size(); ++p){ if(M[k-1-p].first){ if(M[k-1-p].first + inf[p].first > ans){ ans = M[k-1-p].first + inf[p].first; ansc = M[k-1-p].second*inf[p].second; } else if(M[k-1-p].first+inf[p].first == ans){ ansc += M[k-1-p].second*inf[p].second; } } } for(int p = 0; p < inf.size(); ++p){ if(inf[p].first == M[p+1].first) M[p+1].second += inf[p].second; else if(inf[p].first > M[p+1].first) M[p+1] = inf[p]; } } } if(M[k].first > ans){ ans = M[k].first; ansc = M[k].second; } else if(M[k].first == ans){ ansc += M[k].second; } del[u] = true; for(IT e = vec[u].begin(); e != vec[u].end(); ++e){ if(!del[e->first]) dfs(e->second); } } void build(){ queue<int> q; q.push(1); memset(vis,0,sizeof(vis)); memset(dis,0x1f,sizeof(dis)); dis[1] = 0; while(!q.empty()){ int u = q.front(); q.pop(); vis[u] = 0; for(IT e = vv[u].begin(); e != vv[u].end(); ++e){ if(dis[u]+e->second < dis[e->first] || (dis[u]+e->second == dis[e->first] && u < f[e->first])){ dis[e->first] = dis[u] + e->second; f[e->first] = u; fr[e->first] = e->second; if(!vis[e->first]){ vis[e->first] = true; q.push(e->first); } } } } } void build(){ priority_queue<pair<int,int> > q; q.push(mp(0, 1)); memset(vis,0,sizeof(vis)); memset(dis,0x1f,sizeof(dis)); dis[1] = 0; while(!q.empty()){ } } int main(){ int tt, n, m, i, a, b, c; scanf("%d",&tt); while(tt--){ memset(del,0,sizeof(del)); scanf("%d%d%d",&n,&m,&k); k--; for(i=1;i<=n;++i) vv[i].clear(), vec[i].clear(); for(i=1;i<=n;++i){ scanf("%d%d%d",&a,&b,&c); vv[a].pb(mp(b, c)); vv[b].pb(mp(a, c)); } build(); for(i=2;i<=n;++i){ vec[f[i]].pb(mp(i, fr[i])); vec[i].pb(mp(f[i], fr[i])); } ans = 0; dfs(1); printf("%d %d\n", ans, ansc); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #include<conio.h> int main(void){ int a=1; int i,j; for( i=1;i<=9;i++){ for(j=1;j<=9;j++){ printf("%d * %d= %d \n",i,j,i*j); } } getch(); return 0; }
Here is a piece of code written in C: #include<stdio.h> #include<conio.h> int main(void){ int a=1; int i,j; for( i=1;i<=9;i++){ for(j=1;j<=9;j++){ printf("%d * %d= %d \n",i,j,i*j); } } getch(); return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <queue> #include <map> #include <set> #include <vector> #include <string> #include <stack> #include <bitset> #define INF 0x3f3f3f3f #define eps 1e-8 #define FI first #define SE second #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; typedef long long LL; const int maxn=3e4+5; int head[maxn]; struct Edge { int next,to,len; }ed[maxn*4]; int ecnt; int n,m,K; inline void addedge(int u,int v,int c) { ed[ecnt].next=head[u]; ed[ecnt].to=v; ed[ecnt].len=c; head[u]=ecnt++; } int dis[maxn],pre[maxn],prelen[maxn]; bool ok[maxn]; struct node { int u,dis,pre; inline node() {} inline node(int _u,int _dis,int _pre) { u=_u; dis=_dis; pre=_pre; } bool operator <(const node &a)const { return dis>a.dis||(dis==a.dis&&pre>a.pre); } }; priority_queue <node> Q; inline void Dijkstra(int S) { memset(ok,0,(n+3)*sizeof(bool)); memset(dis,0x3f,(n+3)*sizeof(int)); memset(pre,0x3f,(n+3)*sizeof(int)); dis[S]=0; Q.push(node(S,0,S)); node t; while(!Q.empty()) { t=Q.top(); Q.pop(); int u=t.u; if(ok[u]) continue; ok[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(dis[v]>dis[u]+ed[e].len) { dis[v]=dis[u]+ed[e].len; pre[v]=u; prelen[v]=ed[e].len; Q.push(node(v,dis[v],u)); } else if(dis[v]==dis[u]+ed[e].len) { if(pre[v]>u) { pre[v]=u; prelen[v]=ed[e].len; } } } } } inline void build_tree() { memset(head,-1,(n+3)*sizeof(int)); ecnt=0; for(int i=2;i<=n;++i) { addedge(pre[i],i,prelen[i]); addedge(i,pre[i],prelen[i]); } } bool done[maxn]; int sz[maxn],msz[maxn],tr[maxn],tot; void get_size(int u,int fa) { sz[u]=1; msz[u]=1; tr[tot++]=u; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_size(v,u); sz[u]+=sz[v]; msz[u]=max(msz[u],sz[v]); } } inline int Findroot(int u) { tot=0; get_size(u,u); int root,mz=INF; for(int i=0;i<tot;++i) { int v=tr[i]; v=max(msz[v],sz[u]-sz[v]); if(v<mz) { mz=v; root=tr[i]; } } return root; } int dep[maxn],f[maxn],g[maxn]; void get_dep(int u,int fa) { dep[u]=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_dep(v,u); dep[u]=max(dep[u],dep[v]); } ++dep[u]; } int fc[maxn],gc[maxn]; void get_f(int u,int fa,int cnt,int dis) { if(f[cnt]<dis) { f[cnt]=dis; fc[cnt]=1; } else if(f[cnt]==dis) ++fc[cnt]; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_f(v,u,cnt+1,dis+ed[e].len); } } struct Node { int v,d; }po[maxn]; inline bool cmp(Node a,Node b) { return dep[a.v]<dep[b.v]; } int max_len; LL max_cnt; void solve1(int u) { int tot=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; get_dep(v,u); po[tot].v=v; po[tot++].d=ed[e].len; } sort(po,po+tot,cmp); memset(g,0,(dep[po[tot-1].v]+3)*sizeof(int)); int pre=0; for(int i=0;i<tot;++i) { int v=po[i].v; memset(f,0,(dep[v]+3)*sizeof(int)); get_f(v,u,1,po[i].d); int can=K-1; for(int j=0;j<=dep[v];++j) { if(j>can) break; if(can-j<=pre) max_len=max(max_len,f[j]+g[can-j]); } for(int j=0;j<=dep[v];++j) g[j]=max(g[j],f[j]); pre=dep[v]; } done[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; solve1(Findroot(v)); } } void solve2(int u) { int tot=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; get_dep(v,u); po[tot].v=v; po[tot++].d=ed[e].len; } sort(po,po+tot,cmp); memset(g,0,(dep[po[tot-1].v]+3)*sizeof(int)); gc[0]=1; int pre=0; for(int i=0;i<tot;++i) { int v=po[i].v; memset(f,0,(dep[v]+3)*sizeof(int)); get_f(v,u,1,po[i].d); fc[0]=1; int can=K-1; for(int j=1;j<=dep[v];++j) { if(j>can) break; if(can-j<=pre) { if(f[j]+g[can-j]==max_len) max_cnt+=fc[j]*gc[can-j]; } } for(int j=1;j<=dep[v];++j) { if(g[j]<f[j]) { g[j]=f[j]; gc[j]=fc[j]; } else if(g[j]==f[j]) gc[j]+=fc[j]; } pre=dep[v]; } done[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; solve2(Findroot(v)); } } int main() { int T; scanf("%d",&T); while(T--) { scanf("%d%d%d",&n,&m,&K); memset(head,-1,(n+3)*sizeof(int)); ecnt=0; while(m--) { int u,v,c; scanf("%d%d%d",&u,&v,&c); addedge(u,v,c); addedge(v,u,c); } Dijkstra(1); build_tree(); max_len=0; memset(done,0,(n+3)*sizeof(bool)); solve1(Findroot(1)); max_cnt=0; memset(done,0,(n+3)*sizeof(bool)); solve2(Findroot(1)); printf("%d %I64d\n",max_len,max_cnt); } return 0; }
Here is a piece of code written in C: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <cmath> #include <algorithm> #include <queue> #include <map> #include <set> #include <vector> #include <string> #include <stack> #include <bitset> #define INF 0x3f3f3f3f #define eps 1e-8 #define FI first #define SE second #pragma comment(linker,"/STACK:102400000,102400000") using namespace std; typedef long long LL; const int maxn=3e4+5; int head[maxn]; struct Edge { int next,to,len; }ed[maxn*4]; int ecnt; int n,m,K; inline void addedge(int u,int v,int c) { ed[ecnt].next=head[u]; ed[ecnt].to=v; ed[ecnt].len=c; head[u]=ecnt++; } int dis[maxn],pre[maxn],prelen[maxn]; bool ok[maxn]; struct node { int u,dis,pre; inline node() {} inline node(int _u,int _dis,int _pre) { u=_u; dis=_dis; pre=_pre; } bool operator <(const node &a)const { return dis>a.dis||(dis==a.dis&&pre>a.pre); } }; priority_queue <node> Q; inline void Dijkstra(int S) { memset(ok,0,(n+3)*sizeof(bool)); memset(dis,0x3f,(n+3)*sizeof(int)); memset(pre,0x3f,(n+3)*sizeof(int)); dis[S]=0; Q.push(node(S,0,S)); node t; while(!Q.empty()) { t=Q.top(); Q.pop(); int u=t.u; if(ok[u]) continue; ok[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(dis[v]>dis[u]+ed[e].len) { dis[v]=dis[u]+ed[e].len; pre[v]=u; prelen[v]=ed[e].len; Q.push(node(v,dis[v],u)); } else if(dis[v]==dis[u]+ed[e].len) { if(pre[v]>u) { pre[v]=u; prelen[v]=ed[e].len; } } } } } inline void build_tree() { memset(head,-1,(n+3)*sizeof(int)); ecnt=0; for(int i=2;i<=n;++i) { addedge(pre[i],i,prelen[i]); addedge(i,pre[i],prelen[i]); } } bool done[maxn]; int sz[maxn],msz[maxn],tr[maxn],tot; void get_size(int u,int fa) { sz[u]=1; msz[u]=1; tr[tot++]=u; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_size(v,u); sz[u]+=sz[v]; msz[u]=max(msz[u],sz[v]); } } inline int Findroot(int u) { tot=0; get_size(u,u); int root,mz=INF; for(int i=0;i<tot;++i) { int v=tr[i]; v=max(msz[v],sz[u]-sz[v]); if(v<mz) { mz=v; root=tr[i]; } } return root; } int dep[maxn],f[maxn],g[maxn]; void get_dep(int u,int fa) { dep[u]=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_dep(v,u); dep[u]=max(dep[u],dep[v]); } ++dep[u]; } int fc[maxn],gc[maxn]; void get_f(int u,int fa,int cnt,int dis) { if(f[cnt]<dis) { f[cnt]=dis; fc[cnt]=1; } else if(f[cnt]==dis) ++fc[cnt]; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(v==fa||done[v]) continue; get_f(v,u,cnt+1,dis+ed[e].len); } } struct Node { int v,d; }po[maxn]; inline bool cmp(Node a,Node b) { return dep[a.v]<dep[b.v]; } int max_len; LL max_cnt; void solve1(int u) { int tot=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; get_dep(v,u); po[tot].v=v; po[tot++].d=ed[e].len; } sort(po,po+tot,cmp); memset(g,0,(dep[po[tot-1].v]+3)*sizeof(int)); int pre=0; for(int i=0;i<tot;++i) { int v=po[i].v; memset(f,0,(dep[v]+3)*sizeof(int)); get_f(v,u,1,po[i].d); int can=K-1; for(int j=0;j<=dep[v];++j) { if(j>can) break; if(can-j<=pre) max_len=max(max_len,f[j]+g[can-j]); } for(int j=0;j<=dep[v];++j) g[j]=max(g[j],f[j]); pre=dep[v]; } done[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; solve1(Findroot(v)); } } void solve2(int u) { int tot=0; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; get_dep(v,u); po[tot].v=v; po[tot++].d=ed[e].len; } sort(po,po+tot,cmp); memset(g,0,(dep[po[tot-1].v]+3)*sizeof(int)); gc[0]=1; int pre=0; for(int i=0;i<tot;++i) { int v=po[i].v; memset(f,0,(dep[v]+3)*sizeof(int)); get_f(v,u,1,po[i].d); fc[0]=1; int can=K-1; for(int j=1;j<=dep[v];++j) { if(j>can) break; if(can-j<=pre) { if(f[j]+g[can-j]==max_len) max_cnt+=fc[j]*gc[can-j]; } } for(int j=1;j<=dep[v];++j) { if(g[j]<f[j]) { g[j]=f[j]; gc[j]=fc[j]; } else if(g[j]==f[j]) gc[j]+=fc[j]; } pre=dep[v]; } done[u]=1; for(int e=head[u];~e;e=ed[e].next) { int v=ed[e].to; if(done[v]) continue; solve2(Findroot(v)); } } int main() { int T; scanf("%d",&T); while(T--) { scanf("%d%d%d",&n,&m,&K); memset(head,-1,(n+3)*sizeof(int)); ecnt=0; while(m--) { int u,v,c; scanf("%d%d%d",&u,&v,&c); addedge(u,v,c); addedge(v,u,c); } Dijkstra(1); build_tree(); max_len=0; memset(done,0,(n+3)*sizeof(bool)); solve1(Findroot(1)); max_cnt=0; memset(done,0,(n+3)*sizeof(bool)); solve2(Findroot(1)); printf("%d %I64d\n",max_len,max_cnt); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
j=1;main(i){for(;i%10;j%10?:j=1,i++)printf("%dx%d=%d\n",i,j++,i*j);}
Here is a piece of code written in C: j=1;main(i){for(;i%10;j%10?:j=1,i++)printf("%dx%d=%d\n",i,j++,i*j);} Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
j;amin(i){for(;10%i+=j/9;j%=9)printf("%dx%d=%d\n",i,j,++j*i);}
Here is a piece of code written in C: j;amin(i){for(;10%i+=j/9;j%=9)printf("%dx%d=%d\n",i,j,++j*i);} Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <ctime> #include <bitset> #include <algorithm> #include <set> #include <string> #include <vector> #include <map> #include <list> #include <stack> #include <queue> #include <deque> #define LL long long #define PC polygon_convex using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); int cmp(double x) { if(fabs(x) < eps) return 0; if(x > 0)return 1; return -1; } inline double sqr(double x) { return x * x; } struct point { double x, y; point(){} point(double a, double b): x(a), y(b) {} void input(){ scanf("%lf%lf",&x,&y); } friend point operator + (const point &a, const point &b) { return point(a.x + b.x, a.y + b.y); } friend point operator - (const point &a, const point &b) { return point(a.x - b.x, a.y - b.y); } friend bool operator == (const point &a, const point &b) { return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0; } friend point operator * (const point &a, const double &b) { return point(a.x * b, a.y * b); } friend point operator * (const double &a, const point &b) { return point(a * b.x, a * b.y); } friend point operator / (const point &a, const double &b) { return point(a.x / b, a.y / b); } double norm(){ return sqrt(sqr(x) + sqr(y)); } }; double det(const point &a, const point &b) { return a.x * b.y - a.y * b.x; } double dot(const point &a, const point &b) { return a.x * b.x + a.y * b.y; } double dist(const point &a, const point &b) { return (a - b).norm(); } point rotate_point(const point &p, double A){ double tx = p.x, ty = p.y; return point(tx * cos(A) - ty * sin(A), tx * sin(A) + ty * cos(A)); } struct line { point a, b; line(){} line(point x, point y):a(x),b(y){} }; line point_make_line(const point a, const point b) { return line(a,b); } double dis_point_segment(const point p, const point s, const point t) { if(cmp(dot(p - s, t - s))<0) return (p-s).norm(); if(cmp(dot(p - t, s - t))<0) return (p-t).norm(); return fabs(det(s - p, t - p) / dist(s, t)); } void PointProjLine(const point p, const point s, const point t, point &cp) { double r = dot(t - s, p - s) / dot (t - s, t - s); cp = s + r * (t - s); } bool PointOnSegment(point p, point s, point t) { return cmp(det(p - s, t - s))==0 && cmp(dot(p - s, p - t)) <= 0; } bool parallel(line a, line b) { return !cmp(det(a.a - a.b, b.a - b.b)); } bool line_make_point(line a, line b, point &res){ if(parallel(a, b)) return false; double s1 = det(a.a - b.a, b.b - b.a); double s2 = det(a.b - b.a, b.b - b.a); res = (s1 * a.b - s2 * a.a) / (s1 - s2); return true; } const int maxn = 100; struct polygon { int n; point a[maxn]; polygon() {} double perimeter() { double sum = 0; a[n] = a[0]; for (int i = 0; i < n; i++) sum += (a[i+1] - a[i]).norm(); return sum; } double area() { double sum = 0; a[n] = a[0]; for (int i = 0; i < n; i++) sum += det(a[i+1], a[i]); return sum/2.; } int Point_In(point t){ int num = 0, i, d1, d2, k; a[n] = a[0]; for(i = 0; i < n; i++){ if(PointOnSegment(t, a[i], a[i+1])) return 2; k = cmp(det(a[i+1] - a[i], t - a[i])); d1 = cmp(a[i].y - t.y); d2 = cmp(a[i+1].y - t.y); if( k > 0 && d1 <= 0 && d2 > 0) num++; if( k < 0 && d2 <= 0 && d1 > 0) num--; } return num != 0; } }; point polygon::MassCenter() { point ans = point(0, 0); if(cmp(area()) == 0) return ans; a[n] = a[0]; for (int i = 0; i < n; i++) ans = ans + (a[i] + a[i + 1]) * det(a[i + 1], a[i]); return ans / area() / 6.; } struct polygon_convex { vector<point> P; polygon_convex(int Size = 0) { P.resize(Size); } double perimeter() { double ret = 0; int n = P.size(); #define next(i) ( (i + 1) % n) for(int i = 0; i < n; i++) ret += (P[i] - P[next(i)]).norm(); return ret; } double area() { double ret = 0; int n = P.size(); #define next(i) ( (i + 1) % n) for(int i = 0 ;i < n; i++)ret += det(P[next(i)], P[i]); return ret / 2; } }; bool comp_less(const point &a, const point &b){ return cmp(a.x -b.x) < 0 || cmp(a.x - b.x) == 0 && cmp (a.y - b.y) < 0; } polygon_convex convex_hull(vector<point> a) { polygon_convex res(2 * a.size() + 5); sort(a.begin(), a.end(), comp_less); a.erase(unique(a.begin(), a.end()), a.end()); int m = 0; for(int i = 0; i < a.size(); i++){ while( m > 1 && cmp(det(res.P[m-1] - res.P[m-2], a[i] - res.P[m - 2])) <= 0) m--; res.P[m++] = a[i]; } int k = m; for(int i = int(a.size()) - 2; i >= 0; i--) { while(m > k && cmp(det(res.P[m-1] - res.P[m-2], a[i] - res.P[m-2])) <= 0) m--; res.P[m++] = a[i]; } res.P.resize(m); if(a.size() > 1) res.P.resize(m-1); return res; } int main() {};
Here is a piece of code written in C: #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <cmath> #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <ctime> #include <bitset> #include <algorithm> #include <set> #include <string> #include <vector> #include <map> #include <list> #include <stack> #include <queue> #include <deque> #define LL long long #define PC polygon_convex using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); int cmp(double x) { if(fabs(x) < eps) return 0; if(x > 0)return 1; return -1; } inline double sqr(double x) { return x * x; } struct point { double x, y; point(){} point(double a, double b): x(a), y(b) {} void input(){ scanf("%lf%lf",&x,&y); } friend point operator + (const point &a, const point &b) { return point(a.x + b.x, a.y + b.y); } friend point operator - (const point &a, const point &b) { return point(a.x - b.x, a.y - b.y); } friend bool operator == (const point &a, const point &b) { return cmp(a.x - b.x) == 0 && cmp(a.y - b.y) == 0; } friend point operator * (const point &a, const double &b) { return point(a.x * b, a.y * b); } friend point operator * (const double &a, const point &b) { return point(a * b.x, a * b.y); } friend point operator / (const point &a, const double &b) { return point(a.x / b, a.y / b); } double norm(){ return sqrt(sqr(x) + sqr(y)); } }; double det(const point &a, const point &b) { return a.x * b.y - a.y * b.x; } double dot(const point &a, const point &b) { return a.x * b.x + a.y * b.y; } double dist(const point &a, const point &b) { return (a - b).norm(); } point rotate_point(const point &p, double A){ double tx = p.x, ty = p.y; return point(tx * cos(A) - ty * sin(A), tx * sin(A) + ty * cos(A)); } struct line { point a, b; line(){} line(point x, point y):a(x),b(y){} }; line point_make_line(const point a, const point b) { return line(a,b); } double dis_point_segment(const point p, const point s, const point t) { if(cmp(dot(p - s, t - s))<0) return (p-s).norm(); if(cmp(dot(p - t, s - t))<0) return (p-t).norm(); return fabs(det(s - p, t - p) / dist(s, t)); } void PointProjLine(const point p, const point s, const point t, point &cp) { double r = dot(t - s, p - s) / dot (t - s, t - s); cp = s + r * (t - s); } bool PointOnSegment(point p, point s, point t) { return cmp(det(p - s, t - s))==0 && cmp(dot(p - s, p - t)) <= 0; } bool parallel(line a, line b) { return !cmp(det(a.a - a.b, b.a - b.b)); } bool line_make_point(line a, line b, point &res){ if(parallel(a, b)) return false; double s1 = det(a.a - b.a, b.b - b.a); double s2 = det(a.b - b.a, b.b - b.a); res = (s1 * a.b - s2 * a.a) / (s1 - s2); return true; } const int maxn = 100; struct polygon { int n; point a[maxn]; polygon() {} double perimeter() { double sum = 0; a[n] = a[0]; for (int i = 0; i < n; i++) sum += (a[i+1] - a[i]).norm(); return sum; } double area() { double sum = 0; a[n] = a[0]; for (int i = 0; i < n; i++) sum += det(a[i+1], a[i]); return sum/2.; } int Point_In(point t){ int num = 0, i, d1, d2, k; a[n] = a[0]; for(i = 0; i < n; i++){ if(PointOnSegment(t, a[i], a[i+1])) return 2; k = cmp(det(a[i+1] - a[i], t - a[i])); d1 = cmp(a[i].y - t.y); d2 = cmp(a[i+1].y - t.y); if( k > 0 && d1 <= 0 && d2 > 0) num++; if( k < 0 && d2 <= 0 && d1 > 0) num--; } return num != 0; } }; point polygon::MassCenter() { point ans = point(0, 0); if(cmp(area()) == 0) return ans; a[n] = a[0]; for (int i = 0; i < n; i++) ans = ans + (a[i] + a[i + 1]) * det(a[i + 1], a[i]); return ans / area() / 6.; } struct polygon_convex { vector<point> P; polygon_convex(int Size = 0) { P.resize(Size); } double perimeter() { double ret = 0; int n = P.size(); #define next(i) ( (i + 1) % n) for(int i = 0; i < n; i++) ret += (P[i] - P[next(i)]).norm(); return ret; } double area() { double ret = 0; int n = P.size(); #define next(i) ( (i + 1) % n) for(int i = 0 ;i < n; i++)ret += det(P[next(i)], P[i]); return ret / 2; } }; bool comp_less(const point &a, const point &b){ return cmp(a.x -b.x) < 0 || cmp(a.x - b.x) == 0 && cmp (a.y - b.y) < 0; } polygon_convex convex_hull(vector<point> a) { polygon_convex res(2 * a.size() + 5); sort(a.begin(), a.end(), comp_less); a.erase(unique(a.begin(), a.end()), a.end()); int m = 0; for(int i = 0; i < a.size(); i++){ while( m > 1 && cmp(det(res.P[m-1] - res.P[m-2], a[i] - res.P[m - 2])) <= 0) m--; res.P[m++] = a[i]; } int k = m; for(int i = int(a.size()) - 2; i >= 0; i--) { while(m > k && cmp(det(res.P[m-1] - res.P[m-2], a[i] - res.P[m-2])) <= 0) m--; res.P[m++] = a[i]; } res.P.resize(m); if(a.size() > 1) res.P.resize(m-1); return res; } int main() {}; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,m; typedef long long LL; #define DC 50 #define N 100005 LL s[N*5],fab[DC*2],h[DC*2]; int p[N*5],g[N*5][DC]; int dvd(LL x){ if (x <= 0) return 0; return lower_bound(h,h+DC,x) - h; } void update(int k){ s[k] = 0; for (int i=0;i<DC;i++) s[k] += g[k][i] * fab[i]; } void push(int k,int l,int r){ if (p[k] && l != r){ update(k*2); update(k*2+1); p[k*2] = p[k*2+1] = 1; p[k] = 0; } } void add(int k,int l,int r,int x,long long v){ push(k,l,r); if (l == r){ int now = k; int f1 = dvd(s[k]),f2 = dvd(s[k] + v); while (now){ g[now][f1]--; g[now][f2]++; now /= 2; } s[k] += v; return; } int mid = (l + r) / 2; if (x <= mid) add(k*2,l,mid,x,v); else add(k*2+1,mid+1,r,x,v); s[k] = s[k*2] + s[k*2+1]; } void change(int k,int l,int r,int x,int y){ push(k,l,r); if (l == x && r == y){ update(k); p[k] = 1; return; } } LL get(int k,int l,int r,int x,int y){ push(k,l,r); if (l == x && r == y){ return s[k]; } int mid = (l + r) / 2; if (y <= mid) return get(k*2,l,mid,x,y); if (x > mid) return get(k*2+1,mid+1,r,x,y); return get(k*2,l,mid,x,mid) + get(k*2+1,mid+1,r,mid+1,y); } int main(){ freopen("in","r",stdin); fab[0] = 1; fab[1] = 1; for (int i=2;i<DC+1;i++) fab[i] = fab[i-1] + fab[i-2]; for (int i=0;i<DC;i++) fab[i] = fab[i+1]; h[0] = fab[0]; for (int i=1;i<DC;i++) h[i] = fab[i] - (fab[i] - fab[i-1] - 1) / 2; while (scanf("%d%d",&n,&m)!=EOF){ int x,y; for (int i=0;i<m;i++){ scanf("%d",&x); if (x == 1){ scanf("%d%d",&x,&y); add(1,1,n,x,y); continue; } if (x == 2){ scanf("%d%d",&x,&y); printf("%I64d\n",get(1,1,n,x,y)); continue; } if (x == 3){ scanf("%d%d",&x,&y); change(1,1,n,x,y); } } } return 0; }
Here is a piece of code written in C: #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n,m; typedef long long LL; #define DC 50 #define N 100005 LL s[N*5],fab[DC*2],h[DC*2]; int p[N*5],g[N*5][DC]; int dvd(LL x){ if (x <= 0) return 0; return lower_bound(h,h+DC,x) - h; } void update(int k){ s[k] = 0; for (int i=0;i<DC;i++) s[k] += g[k][i] * fab[i]; } void push(int k,int l,int r){ if (p[k] && l != r){ update(k*2); update(k*2+1); p[k*2] = p[k*2+1] = 1; p[k] = 0; } } void add(int k,int l,int r,int x,long long v){ push(k,l,r); if (l == r){ int now = k; int f1 = dvd(s[k]),f2 = dvd(s[k] + v); while (now){ g[now][f1]--; g[now][f2]++; now /= 2; } s[k] += v; return; } int mid = (l + r) / 2; if (x <= mid) add(k*2,l,mid,x,v); else add(k*2+1,mid+1,r,x,v); s[k] = s[k*2] + s[k*2+1]; } void change(int k,int l,int r,int x,int y){ push(k,l,r); if (l == x && r == y){ update(k); p[k] = 1; return; } } LL get(int k,int l,int r,int x,int y){ push(k,l,r); if (l == x && r == y){ return s[k]; } int mid = (l + r) / 2; if (y <= mid) return get(k*2,l,mid,x,y); if (x > mid) return get(k*2+1,mid+1,r,x,y); return get(k*2,l,mid,x,mid) + get(k*2+1,mid+1,r,mid+1,y); } int main(){ freopen("in","r",stdin); fab[0] = 1; fab[1] = 1; for (int i=2;i<DC+1;i++) fab[i] = fab[i-1] + fab[i-2]; for (int i=0;i<DC;i++) fab[i] = fab[i+1]; h[0] = fab[0]; for (int i=1;i<DC;i++) h[i] = fab[i] - (fab[i] - fab[i-1] - 1) / 2; while (scanf("%d%d",&n,&m)!=EOF){ int x,y; for (int i=0;i<m;i++){ scanf("%d",&x); if (x == 1){ scanf("%d%d",&x,&y); add(1,1,n,x,y); continue; } if (x == 2){ scanf("%d%d",&x,&y); printf("%I64d\n",get(1,1,n,x,y)); continue; } if (x == 3){ scanf("%d%d",&x,&y); change(1,1,n,x,y); } } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> #include <cstring> #include <cstdio> #include <queue> #define N 200015 #define M 600300 using namespace std; class FlowNetwork { struct ARC { int u, cap, next; inline void init(int a, int b, int c) { u = a, cap = b, next = c; } } arc[M]; int head[N], n, m, source, sink; int c[N << 1], d[N], pf[N], cur[N]; bool in[N]; queue<int> lab[N * 2], Q; void init(int _n, int _source, int _sink) { n = _n, m = 0, source = _source, sink = _sink; fill(head, head + n, -1); } void add_arc(int s, int t, int cap) { arc[m].init(t, cap, head[s]); head[s] = m++; arc[m].init(s, 0, head[t]); head[t] = m++; } void BFS() { fill(c, c + n * 2, 0); fill(d, d + n, n + 1); d[source] = n, d[sink] = 0; Q.push(sink), c[n + 1] = n - 1; for (int u; !Q.empty();) { u = Q.front(), Q.pop(); --c[n + 1], ++c[d[u]]; for (int e = head[u]; e != -1; e = arc[e].next) { int v = arc[e].u; if (!(d[v] == n + 1 && arc[e ^ 1].cap > 0)) continue; d[v] = d[u] + 1, Q.push(v); } } } int HLPP() { fill(in, in + n, false); for (int i = 0; i < n + n; i++) if (!lab[i].empty()) lab[i].pop(); int todo = -1; BFS(); in[source] = in[sink] = true; fill(pf, pf + n, 0); for (int e = head[source], v; e != -1; e = arc[e].next) { pf[v = arc[e].u] += arc[e].cap; arc[e ^ 1].cap += arc[e].cap, arc[e].cap = 0; if (in[v]) continue; in[v] = true, lab[d[v]].push(v); todo = max(todo, d[v]); } for (int i = 0; i < n; i++) cur[i] = head[i]; for (int tmp; todo >= 0;) { while (todo >= 0 && lab[todo].empty()) todo--; if (todo < 0) break; int u = lab[todo].front(); in[u] = false, lab[todo].pop(); for (int v, f; cur[u] != -1; cur[u] = arc[cur[u]].next) { v = arc[cur[u]].u; if (d[u] != d[v] + 1 || arc[cur[u]].cap == 0) continue; f = min(pf[u], arc[cur[u]].cap); pf[u] -= f, pf[v] += f; arc[cur[u]].cap -= f, arc[cur[u] ^ 1].cap += f; if (!in[v]) in[v] = true, lab[d[v]].push(v); if (pf[u] == 0) break; } if (pf[u] == 0) continue; tmp = d[u], --c[tmp], d[u] = n * 2; for (int e = head[u]; e != -1; e = arc[e].next) { int v = arc[e].u; if (d[u] <= d[v] + 1 || arc[e].cap == 0) continue; d[u] = d[v] + 1, cur[u] = e; } ++c[d[u]], todo = d[u]; in[u] = true, lab[d[u]].push(u); if (c[tmp]) continue; for (int i = 0; i < n; i++) if (d[i] > tmp && d[i] < n + 1) --c[d[i]], ++c[n + 1], d[i] = n + 1; } return pf[sink]; } }; FlowNetwork fn; int T, n, m, L, s, t; int r[410]; int l[410]; int main() { //freopen("data.in","r",stdin); //freopen("data.out","w",stdout); int n, m, k; while (scanf("%d%d%d", &n, &m, &k) != EOF) { int sum1, sum2; sum1 = sum2 = 0; for (int i = 0; i < n; ++i) { scanf("%d", &r[i]); sum1 += r[i]; } for (int j = 0; j < m; ++j) { scanf("%d", &c[i]); sum2 += c[j]; } if (sum1 != sum2) { puts("Impossible"); continue; } int s, t; s = n * m * 2 + n + m; t = s + 1; fn.init(t + 1, s, t); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { int id = i * n + j; fn.add_arc(id, id + n * m, k); } } for (int i = 0; i < n; ++i) { int now = n * m * 2 + i; fn.add_arc(s, now, r[i]); for (int j = 0; j < m; ++j) { fn.add_arc(now, i * n + j, k); } } for (int j = 0; j < m; ++j) { int now = n * m * 2 + n + j; fn.add_arc(now, t, c[j]); for (int i = 0; i < n; ++i) { fn.add_arc(i * n + j + n * m, now, k); } } int ans = fn.HLPP(); if (ans != sum1) puts("Impossible"); else { puts("Unique"); for (int i = 0; i < n; ++i) { for (int j = 0; j < m - 1; ++j) { int now = i * n + j; printf("%d ", fn.arc[now << 1 | 1]); } int now = i * n + m-1; printf("%d\n", fn.arc[now << 1 | 1]); } } } return 0; }
Here is a piece of code written in C: #include <iostream> #include <cstring> #include <cstdio> #include <queue> #define N 200015 #define M 600300 using namespace std; class FlowNetwork { struct ARC { int u, cap, next; inline void init(int a, int b, int c) { u = a, cap = b, next = c; } } arc[M]; int head[N], n, m, source, sink; int c[N << 1], d[N], pf[N], cur[N]; bool in[N]; queue<int> lab[N * 2], Q; void init(int _n, int _source, int _sink) { n = _n, m = 0, source = _source, sink = _sink; fill(head, head + n, -1); } void add_arc(int s, int t, int cap) { arc[m].init(t, cap, head[s]); head[s] = m++; arc[m].init(s, 0, head[t]); head[t] = m++; } void BFS() { fill(c, c + n * 2, 0); fill(d, d + n, n + 1); d[source] = n, d[sink] = 0; Q.push(sink), c[n + 1] = n - 1; for (int u; !Q.empty();) { u = Q.front(), Q.pop(); --c[n + 1], ++c[d[u]]; for (int e = head[u]; e != -1; e = arc[e].next) { int v = arc[e].u; if (!(d[v] == n + 1 && arc[e ^ 1].cap > 0)) continue; d[v] = d[u] + 1, Q.push(v); } } } int HLPP() { fill(in, in + n, false); for (int i = 0; i < n + n; i++) if (!lab[i].empty()) lab[i].pop(); int todo = -1; BFS(); in[source] = in[sink] = true; fill(pf, pf + n, 0); for (int e = head[source], v; e != -1; e = arc[e].next) { pf[v = arc[e].u] += arc[e].cap; arc[e ^ 1].cap += arc[e].cap, arc[e].cap = 0; if (in[v]) continue; in[v] = true, lab[d[v]].push(v); todo = max(todo, d[v]); } for (int i = 0; i < n; i++) cur[i] = head[i]; for (int tmp; todo >= 0;) { while (todo >= 0 && lab[todo].empty()) todo--; if (todo < 0) break; int u = lab[todo].front(); in[u] = false, lab[todo].pop(); for (int v, f; cur[u] != -1; cur[u] = arc[cur[u]].next) { v = arc[cur[u]].u; if (d[u] != d[v] + 1 || arc[cur[u]].cap == 0) continue; f = min(pf[u], arc[cur[u]].cap); pf[u] -= f, pf[v] += f; arc[cur[u]].cap -= f, arc[cur[u] ^ 1].cap += f; if (!in[v]) in[v] = true, lab[d[v]].push(v); if (pf[u] == 0) break; } if (pf[u] == 0) continue; tmp = d[u], --c[tmp], d[u] = n * 2; for (int e = head[u]; e != -1; e = arc[e].next) { int v = arc[e].u; if (d[u] <= d[v] + 1 || arc[e].cap == 0) continue; d[u] = d[v] + 1, cur[u] = e; } ++c[d[u]], todo = d[u]; in[u] = true, lab[d[u]].push(u); if (c[tmp]) continue; for (int i = 0; i < n; i++) if (d[i] > tmp && d[i] < n + 1) --c[d[i]], ++c[n + 1], d[i] = n + 1; } return pf[sink]; } }; FlowNetwork fn; int T, n, m, L, s, t; int r[410]; int l[410]; int main() { //freopen("data.in","r",stdin); //freopen("data.out","w",stdout); int n, m, k; while (scanf("%d%d%d", &n, &m, &k) != EOF) { int sum1, sum2; sum1 = sum2 = 0; for (int i = 0; i < n; ++i) { scanf("%d", &r[i]); sum1 += r[i]; } for (int j = 0; j < m; ++j) { scanf("%d", &c[i]); sum2 += c[j]; } if (sum1 != sum2) { puts("Impossible"); continue; } int s, t; s = n * m * 2 + n + m; t = s + 1; fn.init(t + 1, s, t); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { int id = i * n + j; fn.add_arc(id, id + n * m, k); } } for (int i = 0; i < n; ++i) { int now = n * m * 2 + i; fn.add_arc(s, now, r[i]); for (int j = 0; j < m; ++j) { fn.add_arc(now, i * n + j, k); } } for (int j = 0; j < m; ++j) { int now = n * m * 2 + n + j; fn.add_arc(now, t, c[j]); for (int i = 0; i < n; ++i) { fn.add_arc(i * n + j + n * m, now, k); } } int ans = fn.HLPP(); if (ans != sum1) puts("Impossible"); else { puts("Unique"); for (int i = 0; i < n; ++i) { for (int j = 0; j < m - 1; ++j) { int now = i * n + j; printf("%d ", fn.arc[now << 1 | 1]); } int now = i * n + m-1; printf("%d\n", fn.arc[now << 1 | 1]); } } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #include<string.h> #include<algorithm> #include<vector> #define ll __int64 using namespace std ; const int maxn = 300001 ; const int mod = 1000000007 ; ll ans[maxn] ; struct SAM { int fa[maxn<<1] , val[maxn<<1] , c[26][maxn<<1] ; ll cnt[maxn<<1] ; int tot , last ; int ws[maxn<<1] , wv[maxn<<1] ; vector<int> vec[maxn<<1] ; inline int new_node ( int _val ) { val[++tot] = _val ; for ( int i = 0 ; i < 26 ; i ++ ) c[i][tot] = 0 ; cnt[tot] = fa[tot] = 0 ; return tot ; } void add ( int k ) { int p = last , i ; int np = new_node ( val[p] + 1 ) ; while ( p && !c[k][p] ) c[k][p] = np , p = fa[p] ; if ( !p ) fa[np] = 1 ; else { int q = c[k][p] ; if ( val[q] == val[p] + 1 ) fa[np] = q ; else { int nq = new_node ( val[p] + 1 ) ; for ( i = 0 ; i < 26 ; i ++ ) c[i][nq] = c[i][q] ; fa[nq] = fa[q] ; fa[q] = fa[np] = nq ; while ( p && c[k][p] == q ) c[k][p] = nq , p = fa[p] ; } } last = np ; } void init () { tot = 0 ; last = new_node ( 0 ) ; } void SORT () { for ( int i = 0 ; i < maxn ; i ++ ) wv[i] = 0 ; for ( int i = 1 ; i <= tot ; i ++ ) wv[val[i]] ++ ; for ( int i = 1 ; i < maxn ; i ++ ) wv[i] += wv[i-1] ; for ( int i = 1 ; i <= tot ; i ++ ) ws[wv[val[i]]--] = i ; } void get_cnt ( char *s , int n ) { SORT () ; int now = 1 , i ; memset ( cnt , 0 , sizeof ( cnt ) ) ; for ( i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; now = c[k][now] ; cnt[now] ++ ; } for ( i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt[fa[now]] += cnt[now] ; } } ll cnt_s1[maxn<<1] , cnt_s2[maxn<<1] ; void gao ( char *s ) { int n = strlen ( s ) ; int now = 1 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; if ( c[k][now] ) now = c[k][now] , temp ++ ; else { while ( now && !c[k][now] ) now = fa[now] ; if ( !now ) now = 1 , temp = 0 ; else temp = val[now] + 1 , now = c[k][now] ; } cnt_s1[fa[now]] ++ ; vec[now].push_back ( temp ) ; } for ( int i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt_s1[fa[now]] += cnt_s1[now] ; } } void gao2 ( char *s ) { int n = strlen ( s ) ; int now = 1 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; if ( c[k][now] ) now = c[k][now] , temp ++ ; else { while ( now && !c[k][now] ) now = fa[now] ; if ( !now ) now = 1 , temp = 0 ; else temp = val[now] + 1 , now = c[k][now] ; } if ( now == 1 ) continue ; cnt_s2[fa[now]] ++ ; for ( int j = 0 ; j < vec[now].size () ; j ++ ) { int l = val[fa[now]] + 1 , r = min ( temp , vec[now][j] ) ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[now] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[now] + mod ) % mod ; } } int p = now ; int l = val[fa[p]] + 1 , r = min ( temp , val[p] ) ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[p] * cnt_s1[p] ) % mod ; ans[r+1] = ( ans[r+1] -cnt[p] * cnt_s1[p] % mod + mod ) % mod ; } } for ( int i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt_s2[fa[now]] += cnt_s2[now] ; int l = val[fa[now]] + 1 , r = val[now] ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[now] * cnt_s1[now] % mod * cnt_s2[now] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[now] * cnt_s1[now] % mod * cnt_s2[now] % mod + mod ) % mod ; } } for ( int i = 1 ; i <= tot ; i ++ ) { for ( int j = 0 ; j < vec[i].size () ; j ++ ) { int l = val[fa[i]] + 1 , r = vec[i][j] ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[i] * cnt_s2[i] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[i] * cnt_s2[i] % mod + mod ) % mod ; } } } } } ac ; char s1[maxn] , s2[maxn] ; int main (){ ac.init () ; scanf ( "%s" , s1 ) ; int l = strlen ( s1 ) ; int k = l ; for ( int i = 0 ; i < l ; i ++ ) ac.add ( s1[i] - 'a' ) ; ac.get_cnt ( s1 , l ) ; scanf ( "%s" , s1 ) ; l = strlen ( s1 ) ; k = min ( k , l ) ; ac.gao ( s1 ) ; scanf ( "%s" , s1 ) ; l = strlen ( s1 ) ; k = min ( k , l ) ; ac.gao2 ( s1 ) ; for ( int i = 1 ; i <= k ; i ++ ) { if ( i != 1 ) ans[i] = ( ans[i] + ans[i-1] ) % mod ; printf ( "%I64d " , ans[i] ) ; } puts ( "" ) ; return 0 ; } /* aa aa aa abac abacaba abcd asdfsasd asdasfasd asdasdasdasd */
Here is a piece of code written in C: #include<stdio.h> #include<string.h> #include<algorithm> #include<vector> #define ll __int64 using namespace std ; const int maxn = 300001 ; const int mod = 1000000007 ; ll ans[maxn] ; struct SAM { int fa[maxn<<1] , val[maxn<<1] , c[26][maxn<<1] ; ll cnt[maxn<<1] ; int tot , last ; int ws[maxn<<1] , wv[maxn<<1] ; vector<int> vec[maxn<<1] ; inline int new_node ( int _val ) { val[++tot] = _val ; for ( int i = 0 ; i < 26 ; i ++ ) c[i][tot] = 0 ; cnt[tot] = fa[tot] = 0 ; return tot ; } void add ( int k ) { int p = last , i ; int np = new_node ( val[p] + 1 ) ; while ( p && !c[k][p] ) c[k][p] = np , p = fa[p] ; if ( !p ) fa[np] = 1 ; else { int q = c[k][p] ; if ( val[q] == val[p] + 1 ) fa[np] = q ; else { int nq = new_node ( val[p] + 1 ) ; for ( i = 0 ; i < 26 ; i ++ ) c[i][nq] = c[i][q] ; fa[nq] = fa[q] ; fa[q] = fa[np] = nq ; while ( p && c[k][p] == q ) c[k][p] = nq , p = fa[p] ; } } last = np ; } void init () { tot = 0 ; last = new_node ( 0 ) ; } void SORT () { for ( int i = 0 ; i < maxn ; i ++ ) wv[i] = 0 ; for ( int i = 1 ; i <= tot ; i ++ ) wv[val[i]] ++ ; for ( int i = 1 ; i < maxn ; i ++ ) wv[i] += wv[i-1] ; for ( int i = 1 ; i <= tot ; i ++ ) ws[wv[val[i]]--] = i ; } void get_cnt ( char *s , int n ) { SORT () ; int now = 1 , i ; memset ( cnt , 0 , sizeof ( cnt ) ) ; for ( i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; now = c[k][now] ; cnt[now] ++ ; } for ( i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt[fa[now]] += cnt[now] ; } } ll cnt_s1[maxn<<1] , cnt_s2[maxn<<1] ; void gao ( char *s ) { int n = strlen ( s ) ; int now = 1 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; if ( c[k][now] ) now = c[k][now] , temp ++ ; else { while ( now && !c[k][now] ) now = fa[now] ; if ( !now ) now = 1 , temp = 0 ; else temp = val[now] + 1 , now = c[k][now] ; } cnt_s1[fa[now]] ++ ; vec[now].push_back ( temp ) ; } for ( int i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt_s1[fa[now]] += cnt_s1[now] ; } } void gao2 ( char *s ) { int n = strlen ( s ) ; int now = 1 , temp = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int k = s[i] - 'a' ; if ( c[k][now] ) now = c[k][now] , temp ++ ; else { while ( now && !c[k][now] ) now = fa[now] ; if ( !now ) now = 1 , temp = 0 ; else temp = val[now] + 1 , now = c[k][now] ; } if ( now == 1 ) continue ; cnt_s2[fa[now]] ++ ; for ( int j = 0 ; j < vec[now].size () ; j ++ ) { int l = val[fa[now]] + 1 , r = min ( temp , vec[now][j] ) ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[now] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[now] + mod ) % mod ; } } int p = now ; int l = val[fa[p]] + 1 , r = min ( temp , val[p] ) ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[p] * cnt_s1[p] ) % mod ; ans[r+1] = ( ans[r+1] -cnt[p] * cnt_s1[p] % mod + mod ) % mod ; } } for ( int i = tot ; i >= 1 ; i -- ) { now = ws[i] ; cnt_s2[fa[now]] += cnt_s2[now] ; int l = val[fa[now]] + 1 , r = val[now] ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[now] * cnt_s1[now] % mod * cnt_s2[now] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[now] * cnt_s1[now] % mod * cnt_s2[now] % mod + mod ) % mod ; } } for ( int i = 1 ; i <= tot ; i ++ ) { for ( int j = 0 ; j < vec[i].size () ; j ++ ) { int l = val[fa[i]] + 1 , r = vec[i][j] ; if ( l <= r ) { ans[l] = ( ans[l] + cnt[i] * cnt_s2[i] ) % mod ; ans[r+1] = ( ans[r+1] - cnt[i] * cnt_s2[i] % mod + mod ) % mod ; } } } } } ac ; char s1[maxn] , s2[maxn] ; int main (){ ac.init () ; scanf ( "%s" , s1 ) ; int l = strlen ( s1 ) ; int k = l ; for ( int i = 0 ; i < l ; i ++ ) ac.add ( s1[i] - 'a' ) ; ac.get_cnt ( s1 , l ) ; scanf ( "%s" , s1 ) ; l = strlen ( s1 ) ; k = min ( k , l ) ; ac.gao ( s1 ) ; scanf ( "%s" , s1 ) ; l = strlen ( s1 ) ; k = min ( k , l ) ; ac.gao2 ( s1 ) ; for ( int i = 1 ; i <= k ; i ++ ) { if ( i != 1 ) ans[i] = ( ans[i] + ans[i-1] ) % mod ; printf ( "%I64d " , ans[i] ) ; } puts ( "" ) ; return 0 ; } /* aa aa aa abac abacaba abcd asdfsasd asdasfasd asdasdasdasd */ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <cstring> using namespace std; int n,f; #define N 805 int e[N][N]; int g[1<<20]; struct MAT{ int a[N][N]; }a,b,c,d; void divide1(MAT &a){ for (int k=0;k<n;k++){ for (int i=0;i<f;i++){ int s = 0; for (int j=i*20;j<n && j<i*20+20;j++){ s *= 2; s += a.a[i][j]; } a.a[k][f] = s; } } } void divide2(MAT &a){ for (int k=0;k<n;k++){ for (int i=0;i<f;i++){ int s = 0; for (int j=i*20;j<n && j<i*20+20;j++){ s *= 2; s += a.a[j][i]; } a.a[f][k] = s; } } } void mul(MAT a,MAT b){ for (int i=0;i<n;i++) for (int j=0;j<n;j++){ int s = 0; for (int k=0;k<f;k++){ s += g[a.a[i][k] & b.a[k][j]]; } e[i][j] += s % 3; } } void init(){ for (int i=0;i<(1<<20);i++){ int x = i; while (x){ g[i]++; x &=(x-1); } } } int main(){ init(); while (scanf("%d",&n)!=EOF && n > 0){ for (int i=0;i<n;i++) for (int j=0;j<n;j++){ scanf("%d",&a.a[i][j]); a.a[i][j] %= 3; if (a.a[i][j] == 2){ b.a[i][j] ++; a.a[i][j]--; } } for (int i=0;i<n;i++) for (int j=0;j<n;j++){ scanf("%d",&c.a[i][j]); c.a[i][j] %= 3; if (c.a[i][j] == 2){ d.a[i][j]++; c.a[i][j]--; } } f = (n + 19) / 20; divide1(a); divide1(b); divide2(c); divide2(d); mul(a,c); mul(a,d); mul(b,c); mul(b,d); for (int i=0;i<n;i++) for (int j=0;j<n;j++){ printf("%d",e[i][j]%3); if (j == n - 1) printf("\n"); else printf(" "); } } return 0; }
Here is a piece of code written in C: #include <cstdio> #include <cstring> using namespace std; int n,f; #define N 805 int e[N][N]; int g[1<<20]; struct MAT{ int a[N][N]; }a,b,c,d; void divide1(MAT &a){ for (int k=0;k<n;k++){ for (int i=0;i<f;i++){ int s = 0; for (int j=i*20;j<n && j<i*20+20;j++){ s *= 2; s += a.a[i][j]; } a.a[k][f] = s; } } } void divide2(MAT &a){ for (int k=0;k<n;k++){ for (int i=0;i<f;i++){ int s = 0; for (int j=i*20;j<n && j<i*20+20;j++){ s *= 2; s += a.a[j][i]; } a.a[f][k] = s; } } } void mul(MAT a,MAT b){ for (int i=0;i<n;i++) for (int j=0;j<n;j++){ int s = 0; for (int k=0;k<f;k++){ s += g[a.a[i][k] & b.a[k][j]]; } e[i][j] += s % 3; } } void init(){ for (int i=0;i<(1<<20);i++){ int x = i; while (x){ g[i]++; x &=(x-1); } } } int main(){ init(); while (scanf("%d",&n)!=EOF && n > 0){ for (int i=0;i<n;i++) for (int j=0;j<n;j++){ scanf("%d",&a.a[i][j]); a.a[i][j] %= 3; if (a.a[i][j] == 2){ b.a[i][j] ++; a.a[i][j]--; } } for (int i=0;i<n;i++) for (int j=0;j<n;j++){ scanf("%d",&c.a[i][j]); c.a[i][j] %= 3; if (c.a[i][j] == 2){ d.a[i][j]++; c.a[i][j]--; } } f = (n + 19) / 20; divide1(a); divide1(b); divide2(c); divide2(d); mul(a,c); mul(a,d); mul(b,c); mul(b,d); for (int i=0;i<n;i++) for (int j=0;j<n;j++){ printf("%d",e[i][j]%3); if (j == n - 1) printf("\n"); else printf(" "); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <cstring> #include <iostream> using namespace std; char s[1111]; int num[10]; void fj(int x) { int i; for(i = 2; i * i <= x; i++) while(x % i == 0) { num[i]++; x /= i; } if(x > 1) num[x]++; } bool can_f(int x) { int i; for(i = 2; i * i <= x; i++) { int k = 0; while(x % i == 0) { x /= i; k++; } if(num[i] < k) return false; } if(x > 1) if(num[x] < 1) return false; return true; } void f(int x) { int i; for(i = 2; i * i <= x; i++) while(x % i == 0) { num[i]--; x /= i; } if(x > 1) num[x]--; } int main() { int T; scanf("%d", &T); while(T--) { memset(num, 0, sizeof(num)); scanf("%s", s); int len = strlen(s); if(len == 1) { printf("1%s\n", s); continue; } fj(s[len - 1] - '0'); int i, j, minp, t, m; j = -1; for(i = 0; i < len; i++) if(s[i] == '0') { j = i; break; } if(j >= 0) { for(i = len - 1; i >= 0; i--) if(j != len - 1 || i != len - 1) { if(s[i] < '9') { s[i]++; break; } } if(i < 0) printf("1"); for(i++; i < len; i++) s[i] = '0'; printf("%s\n"); continue; } for(minp = 2; minp < 10; minp++) if(num[minp] > 0) break; for(i = len - 2; i >= 0; i--) { for(minp = 2; minp < 10; minp++) if(num[minp] > 0) break; int a = s[i] - '0'; for(m = 2; m < 10; m++) if(m > a && num[m] > 0) break; t = min(a * minp, m); if(t < 10) { s[i] = t + '0'; fj(a); f(t); break; } fj(s[i] - '0'); } if(i < 0) printf("1"); int k = i; for(i = len - 1; i > k; i--) { for(j = 9; j > 0; j--) { if(can_f(j)) { f(j); s[i] = j + '0'; break; } } } printf("%s\n", s); } return 0; }
Here is a piece of code written in C: #include <cstdio> #include <cstring> #include <iostream> using namespace std; char s[1111]; int num[10]; void fj(int x) { int i; for(i = 2; i * i <= x; i++) while(x % i == 0) { num[i]++; x /= i; } if(x > 1) num[x]++; } bool can_f(int x) { int i; for(i = 2; i * i <= x; i++) { int k = 0; while(x % i == 0) { x /= i; k++; } if(num[i] < k) return false; } if(x > 1) if(num[x] < 1) return false; return true; } void f(int x) { int i; for(i = 2; i * i <= x; i++) while(x % i == 0) { num[i]--; x /= i; } if(x > 1) num[x]--; } int main() { int T; scanf("%d", &T); while(T--) { memset(num, 0, sizeof(num)); scanf("%s", s); int len = strlen(s); if(len == 1) { printf("1%s\n", s); continue; } fj(s[len - 1] - '0'); int i, j, minp, t, m; j = -1; for(i = 0; i < len; i++) if(s[i] == '0') { j = i; break; } if(j >= 0) { for(i = len - 1; i >= 0; i--) if(j != len - 1 || i != len - 1) { if(s[i] < '9') { s[i]++; break; } } if(i < 0) printf("1"); for(i++; i < len; i++) s[i] = '0'; printf("%s\n"); continue; } for(minp = 2; minp < 10; minp++) if(num[minp] > 0) break; for(i = len - 2; i >= 0; i--) { for(minp = 2; minp < 10; minp++) if(num[minp] > 0) break; int a = s[i] - '0'; for(m = 2; m < 10; m++) if(m > a && num[m] > 0) break; t = min(a * minp, m); if(t < 10) { s[i] = t + '0'; fj(a); f(t); break; } fj(s[i] - '0'); } if(i < 0) printf("1"); int k = i; for(i = len - 1; i > k; i--) { for(j = 9; j > 0; j--) { if(can_f(j)) { f(j); s[i] = j + '0'; break; } } } printf("%s\n", s); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
//C headers #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <ctype.h> #include <assert.h> //cpp headers #include <iostream> #include <iomanip> #include <sstream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <stack> #include <deque> #include <list> #include <bits/stdc++.h> //#include <bitset> using namespace std; //typedefs typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef char C; typedef string S; //some constants const double PI = 2.0 * acos(0.0); const double E = exp(1); //always useful #define gcd(a,b) __gcd(a,b) #define clr(a) memset(a, 0, sizeof(a)) #define mem(a,b) memset(a, b, sizeof(a)) #define REP(i, a, n) for(int i = a; i < n; ++i) #define RREP(i, a, n) for(int i = a; i > n; --i) #define REPE(i, a, n) for(int i = a; i <= n; ++i) #define RREPE(i, a, n) for(int i = a; i >= n; --i) //useful with graphs #define fr first #define sc second #define pb push_back #define pp pop_back #define mp make_pair #define IT iterator #define all(v) v.begin(), v.end() #define ssort(v) stable_sort(v.begin(), v.end()) #define LB(v, x) lower_bound(v.begin(), v.end(), x) #define UB(v, x) upper_bound(v.begin(), v.end(), x) #define loop(i, x) for(__typeof((x).begin()) i=(x.begin()); i!=(x).end(); ++i) #define rloop(i, x) for(__typeof((x).rbegin()) i=(x.rbegin()); i!=(x).rend(); ++i) #define sz(a) (int)a.size() #define sf scanf #define pf printf #define NL pf("\n") #define sf1(a) scanf("%d",&a) #define sf2(a,b) scanf("%d %d",&a,&b) #define sf3(a,b,c) scanf("%d %d %d", &a,&b, &c); #define sf4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d); #define oo 1000000000 #define MOD 1000007 #define M 100099 //ll extGcd(ll a, ll b, ll& x, ll& y){if (b == 0){x = 1;y = 0;return a;}else{int g = extGcd(b, a % b, y, x);y -= a / b * x;return g;}} //ll modInv(ll a, ll m){ll x, y; extGcd(a, m, x, y); x %= m; while (x < 0){x += m;} return x;} //ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;} //ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} ret urn R;} /// (B^P)%M //template <class T> inline T gcd(T a, T b){if(b == 0) return a;return gcd(b,a%b);} //template <class T> inline T lcm(T a, T b){return (a/gcd(a,b)) * b;} //int x[] = {0,0,-1,1};//4-way //int y[] = {-1,1,0,0};//4-way //ll x[] = {-1,-1,-1,0,0,1,1,1};//8-way //ll y[] = {-1,0,1,-1,1,-1,0,1};//8-way //inline long FastMax(long x, long y) { return (((y-x)>>(32-1))&(x^y))^y; } //inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; } //inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; } //#include<conio.h> //#define wait getch() int cases = 1; int main() { int test; return 0; }
Here is a piece of code written in C: //C headers #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <limits.h> #include <ctype.h> #include <assert.h> //cpp headers #include <iostream> #include <iomanip> #include <sstream> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <stack> #include <deque> #include <list> #include <bits/stdc++.h> //#include <bitset> using namespace std; //typedefs typedef long long ll; typedef unsigned long long ull; typedef pair<ll, ll> pll; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; typedef char C; typedef string S; //some constants const double PI = 2.0 * acos(0.0); const double E = exp(1); //always useful #define gcd(a,b) __gcd(a,b) #define clr(a) memset(a, 0, sizeof(a)) #define mem(a,b) memset(a, b, sizeof(a)) #define REP(i, a, n) for(int i = a; i < n; ++i) #define RREP(i, a, n) for(int i = a; i > n; --i) #define REPE(i, a, n) for(int i = a; i <= n; ++i) #define RREPE(i, a, n) for(int i = a; i >= n; --i) //useful with graphs #define fr first #define sc second #define pb push_back #define pp pop_back #define mp make_pair #define IT iterator #define all(v) v.begin(), v.end() #define ssort(v) stable_sort(v.begin(), v.end()) #define LB(v, x) lower_bound(v.begin(), v.end(), x) #define UB(v, x) upper_bound(v.begin(), v.end(), x) #define loop(i, x) for(__typeof((x).begin()) i=(x.begin()); i!=(x).end(); ++i) #define rloop(i, x) for(__typeof((x).rbegin()) i=(x.rbegin()); i!=(x).rend(); ++i) #define sz(a) (int)a.size() #define sf scanf #define pf printf #define NL pf("\n") #define sf1(a) scanf("%d",&a) #define sf2(a,b) scanf("%d %d",&a,&b) #define sf3(a,b,c) scanf("%d %d %d", &a,&b, &c); #define sf4(a,b,c,d) scanf("%d%d%d%d",&a,&b,&c,&d); #define oo 1000000000 #define MOD 1000007 #define M 100099 //ll extGcd(ll a, ll b, ll& x, ll& y){if (b == 0){x = 1;y = 0;return a;}else{int g = extGcd(b, a % b, y, x);y -= a / b * x;return g;}} //ll modInv(ll a, ll m){ll x, y; extGcd(a, m, x, y); x %= m; while (x < 0){x += m;} return x;} //ll bigmod(ll a,ll b,ll m){if(b == 0) return 1%m;ll x = bigmod(a,b/2,m);x = (x * x) % m;if(b % 2 == 1) x = (x * a) % m;return x;} //ll BigMod(ll B,ll P,ll M){ ll R=1%M; while(P>0) {if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;} ret urn R;} /// (B^P)%M //template <class T> inline T gcd(T a, T b){if(b == 0) return a;return gcd(b,a%b);} //template <class T> inline T lcm(T a, T b){return (a/gcd(a,b)) * b;} //int x[] = {0,0,-1,1};//4-way //int y[] = {-1,1,0,0};//4-way //ll x[] = {-1,-1,-1,0,0,1,1,1};//8-way //ll y[] = {-1,0,1,-1,1,-1,0,1};//8-way //inline long FastMax(long x, long y) { return (((y-x)>>(32-1))&(x^y))^y; } //inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; } //inline long FastMin(long x, long y) { return (((y-x)>>(32-1))&(x^y))^x; } //#include<conio.h> //#define wait getch() int cases = 1; int main() { int test; return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void) { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(void) { for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(void) { int a,b; for(a=1;a<10;a++) { for(b=1;b<10;b++) { printf("%dx%d=%d",a,b,a*b); } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(void) { int a,b; for(a=1;a<10;a++) { for(b=1;b<10;b++) { printf("%dx%d=%d",a,b,a*b); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(void){
Here is a piece of code written in C: #include<stdio.h> int main(void){ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(void){
Here is a piece of code written in C: #include<stdio.h> int main(void){ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void) { for (int i = 1; i <= 9; i++){ for (int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i*j); } } return (0); }
Here is a piece of code written in C: #include <stdio.h> int main(void) { for (int i = 1; i <= 9; i++){ for (int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i*j); } } return (0); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
***********************************************************/ /* Clear function: reset and initialize the population */ /***********************************************************/ void clear() { int i,j; for (i = 0; i < NVARS; i++) { for (j = 0; j <= POPSIZE; j++) { population[j].fitness = 0; population[j].rfitness = 0; population[j].cfitness = 0; population[j].gene[i] = randval(population[j].lower[i], population[j].upper[i]); } } }
Here is a piece of code written in C: ***********************************************************/ /* Clear function: reset and initialize the population */ /***********************************************************/ void clear() { int i,j; for (i = 0; i < NVARS; i++) { for (j = 0; j <= POPSIZE; j++) { population[j].fitness = 0; population[j].rfitness = 0; population[j].cfitness = 0; population[j].gene[i] = randval(population[j].lower[i], population[j].upper[i]); } } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for(int i=1;i<10;i++){ for(int j=1;j<10;j++){ printf("%d×%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for(int i=1;i<10;i++){ for(int j=1;j<10;j++){ printf("%d×%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
1x1=1 1x2=2 . . 9x8=72 9x9=81 1x1=1 1x2=2 . . 9x8=72 9x9=81 1x1=1 1x2=2 . . 9x8=72 9x9=81
Here is a piece of code written in C: 1x1=1 1x2=2 . . 9x8=72 9x9=81 1x1=1 1x2=2 . . 9x8=72 9x9=81 1x1=1 1x2=2 . . 9x8=72 9x9=81 Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main() { for(i=1;i<=9;i++) for(j=1;j<=9;j++) printf("%d*%d=%d,i,j,i*j"); return 0; }
Here is a piece of code written in C: #include <stdio.h> int main() { for(i=1;i<=9;i++) for(j=1;j<=9;j++) printf("%d*%d=%d,i,j,i*j"); return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
荳雁捉荳サ隕∝惠陦・莉・蜑咲噪鬚倡岼蜥悟姐CF逧ДP,證よ慮豐。譛牙ュヲ譁ー逧?ョ玲ウ? 豈碑オ帶ッ碑セ?、壼黄菴咏噪鬚倡岼霑俶怏蠕亥、壽イ。譛牙所譌カ逧?。・謗?莉・蜷手。・逧??蠎ヲ霑倩ヲ∝刈蠢ォ. 譛?ソ大?蝨コ豈碑オ帑クュ,謌台サャ髦滉シ咲噪驟榊粋荳榊、溷・ス. 1:譛画慮蛟吩シ壼惠荳?%鬚倡岼荳?蝗?クコ荳?コ帷サ?鰍豬ェ雍ケ蠕磯柄逧?慮髣エ,隨ャ6蝨コ扈?弌襍侫鬚伜屏荳コ闌?峩蠑?ー丈コ?ク?せ,蝨ィ隨ャ荳?ャ。謠蝉コ、霑?コ?ソォ蜊贋クェ蟆乗慮謇榊書邇ー. 2:蟇ケ莠取汾莠幃「倡岼螟ェ霑?ーィ諷惹コ?隨ャ8蝨コ扈?弌襍帑ク?峩莉・荳コH鬚倡噪螟肴揩蠎ヲ螟ェ鬮伜柱譌カ髣エ蛻??譛蛾琉鬚伜ーア豐。譛画署莠、,莠句ョ樔ク贋ク崎ヲ∽サ?ケ井シ伜喧驛ス蜿ッ莉・.霑俶怏荳?クェ鬚倡岼WW扈吩コ?クェ霑樊?遞矩?TLE逧?セ句ュ蝉ケ句錘,謌台サャ蟆ア謾セ蠑?コ?蜈カ螳樔ケ滓弍蠎比クコ謨ー謐ョ豌エ蜿ッ莉・髫丈セソ霑?噪.豈碑オ帷噪扈城ェ瑚ソ俶弍荳榊、?
Here is a piece of code written in C: 荳雁捉荳サ隕∝惠陦・莉・蜑咲噪鬚倡岼蜥悟姐CF逧ДP,證よ慮豐。譛牙ュヲ譁ー逧?ョ玲ウ? 豈碑オ帶ッ碑セ?、壼黄菴咏噪鬚倡岼霑俶怏蠕亥、壽イ。譛牙所譌カ逧?。・謗?莉・蜷手。・逧??蠎ヲ霑倩ヲ∝刈蠢ォ. 譛?ソ大?蝨コ豈碑オ帑クュ,謌台サャ髦滉シ咲噪驟榊粋荳榊、溷・ス. 1:譛画慮蛟吩シ壼惠荳?%鬚倡岼荳?蝗?クコ荳?コ帷サ?鰍豬ェ雍ケ蠕磯柄逧?慮髣エ,隨ャ6蝨コ扈?弌襍侫鬚伜屏荳コ闌?峩蠑?ー丈コ?ク?せ,蝨ィ隨ャ荳?ャ。謠蝉コ、霑?コ?ソォ蜊贋クェ蟆乗慮謇榊書邇ー. 2:蟇ケ莠取汾莠幃「倡岼螟ェ霑?ーィ諷惹コ?隨ャ8蝨コ扈?弌襍帑ク?峩莉・荳コH鬚倡噪螟肴揩蠎ヲ螟ェ鬮伜柱譌カ髣エ蛻??譛蛾琉鬚伜ーア豐。譛画署莠、,莠句ョ樔ク贋ク崎ヲ∽サ?ケ井シ伜喧驛ス蜿ッ莉・.霑俶怏荳?クェ鬚倡岼WW扈吩コ?クェ霑樊?遞矩?TLE逧?セ句ュ蝉ケ句錘,謌台サャ蟆ア謾セ蠑?コ?蜈カ螳樔ケ滓弍蠎比クコ謨ー謐ョ豌エ蜿ッ莉・髫丈セソ霑?噪.豈碑オ帷噪扈城ェ瑚ソ俶弍荳榊、? Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <iostream> #include <algorithm> using namespace std; const int N = 1009; int mabs(int x) { if(x > 0) return x; return -x; } struct xiang { int xs[1001]; int n; void print() { printf("("); for(int i = n - 1; i >= 0; i--) { if(xs[i] == 0) continue; if(i < n - 1) { if(xs[i] < 0) printf("-"); else printf("+"); } if(i == 1) { printf("x"); continue; } if(i == 0) { printf("%d", mabs(xs[i])); continue; } if(xs[i] == 1 || xs[i] == -1) printf("x^%d", i); else printf("%dx^%d", mabs(xs[i]), i); } printf(")"); } }x[222]; int isp[1111]; int xn; bool cmp(const xiang &a, const xiang &b) { if(a.n != b.n) return a.n < b.n; int i; for(i = a.n - 1; i >= 0; i--) { if(a.xs[i] != b.xs[i]) return a.xs[i] < b.xs[i]; } return a.n < b.n; } void dfs(int t, int n, int k) { printf("%d %d %d\n", t, n, k); int i; if(k > 0) { if((n & 1) == 0) { x[xn].n = n * t + 1; x[xn].xs[n * t] = 1; x[xn].xs[0] = 1; xn++; return; } dfs(1, t, -1); x[xn].n = n * t + 1; for(i = x[xn].n - 1; i >= 0; i -= t) { x[xn].xs[i] = k; k = -k; } xn++; return; } if(!isp[n]) { dfs(1, t, -1); xn++; x[xn].n = n; for(i = x[xn].n - 1; i >= 0; i--) x[xn].xs[i] = 1; xn++; return; } for(i = 2; i < n; i++) if(n % i == 0) { n /= i; dfs(i, n, -1); if(i == 2) dfs(i, n, 1); return; } } int main() { int n, i, j; for(i = 2; i * i < N; i++) if(!isp[i]) for(j = i * i; j < N; j += i) isp[j] = 1; while(scanf("%d", &n) != EOF) { if(n == 0) break; if(n == 1) { puts("x-1"); continue; } xn = 0; dfs(1, n, -1); sort(x, x + xn, cmp); for(i = 0; i < xn; i++) x[i].print(); printf("\n"); } return 0; }
Here is a piece of code written in C: #include <cstdio> #include <iostream> #include <algorithm> using namespace std; const int N = 1009; int mabs(int x) { if(x > 0) return x; return -x; } struct xiang { int xs[1001]; int n; void print() { printf("("); for(int i = n - 1; i >= 0; i--) { if(xs[i] == 0) continue; if(i < n - 1) { if(xs[i] < 0) printf("-"); else printf("+"); } if(i == 1) { printf("x"); continue; } if(i == 0) { printf("%d", mabs(xs[i])); continue; } if(xs[i] == 1 || xs[i] == -1) printf("x^%d", i); else printf("%dx^%d", mabs(xs[i]), i); } printf(")"); } }x[222]; int isp[1111]; int xn; bool cmp(const xiang &a, const xiang &b) { if(a.n != b.n) return a.n < b.n; int i; for(i = a.n - 1; i >= 0; i--) { if(a.xs[i] != b.xs[i]) return a.xs[i] < b.xs[i]; } return a.n < b.n; } void dfs(int t, int n, int k) { printf("%d %d %d\n", t, n, k); int i; if(k > 0) { if((n & 1) == 0) { x[xn].n = n * t + 1; x[xn].xs[n * t] = 1; x[xn].xs[0] = 1; xn++; return; } dfs(1, t, -1); x[xn].n = n * t + 1; for(i = x[xn].n - 1; i >= 0; i -= t) { x[xn].xs[i] = k; k = -k; } xn++; return; } if(!isp[n]) { dfs(1, t, -1); xn++; x[xn].n = n; for(i = x[xn].n - 1; i >= 0; i--) x[xn].xs[i] = 1; xn++; return; } for(i = 2; i < n; i++) if(n % i == 0) { n /= i; dfs(i, n, -1); if(i == 2) dfs(i, n, 1); return; } } int main() { int n, i, j; for(i = 2; i * i < N; i++) if(!isp[i]) for(j = i * i; j < N; j += i) isp[j] = 1; while(scanf("%d", &n) != EOF) { if(n == 0) break; if(n == 1) { puts("x-1"); continue; } xn = 0; dfs(1, n, -1); sort(x, x + xn, cmp); for(i = 0; i < xn; i++) x[i].print(); printf("\n"); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <cstdio> #include <cstring> #include <vector> using namespace std; int n, q; #define N 100005 vector<int> e[N], w[N]; vector< pair<int,int> > g[N]; int p[N], f[N]; #define pb push_back typedef long long ll; ll d[N], ans[N]; int getf(int k){ return (f[k] == k) ? k : f[k] = getf(f[k]); } void dfs(int k,int fa){ for (int i=0;i<e[k].size();i++){ if (e[k][i] == fa) continue; d[e[k][i]] = d[k] + w[k][i]; dfs(e[k][i],k); } } void gao(int k){ p[k] = 1; for (int i=0;i<g[k].size();i++){ int x = g[k][i].first, y = g[k][i].second; if (p[x] == 0) continue; int fa = getf(x); ans[y] = d[k] + d[x] - d[fa]; } for (int i=0;i<e[k].size();i++){ if (p[e[k][i]]) continue; gao(e[k][i]); f[e[k][i]] = k; } } int main(){ freopen("in","r",stdin); while (scanf("%d",&n) != EOF && n > 0){ int a, b; for (int i=1;i<n;i++){ scanf("%d%d",&a,&b); e[i].pb(a); w[i].pb(b); e[a].pb(i); w[a].pb(b); } scanf("%d",&q); for (int i=0;i<q;i++){ scanf("%d%d",&a,&b); g[a].pb(make_pair(b,i)); g[b].pb(make_pair(a,i)); } dfs(0,-1); for (int i=0;i<n;i++){ printf("%lld\n",d[i]); } memset(p,0,sizeof(p)); for (int i=0;i<n;i++){ f[i] = i; } for (int i=0;i<q;i++){ printf("%lld",ans[i]); if (i != q - 1){ printf(" "); } else { printf("\n"); } } } return 0; }
Here is a piece of code written in C: #include <cstdio> #include <cstring> #include <vector> using namespace std; int n, q; #define N 100005 vector<int> e[N], w[N]; vector< pair<int,int> > g[N]; int p[N], f[N]; #define pb push_back typedef long long ll; ll d[N], ans[N]; int getf(int k){ return (f[k] == k) ? k : f[k] = getf(f[k]); } void dfs(int k,int fa){ for (int i=0;i<e[k].size();i++){ if (e[k][i] == fa) continue; d[e[k][i]] = d[k] + w[k][i]; dfs(e[k][i],k); } } void gao(int k){ p[k] = 1; for (int i=0;i<g[k].size();i++){ int x = g[k][i].first, y = g[k][i].second; if (p[x] == 0) continue; int fa = getf(x); ans[y] = d[k] + d[x] - d[fa]; } for (int i=0;i<e[k].size();i++){ if (p[e[k][i]]) continue; gao(e[k][i]); f[e[k][i]] = k; } } int main(){ freopen("in","r",stdin); while (scanf("%d",&n) != EOF && n > 0){ int a, b; for (int i=1;i<n;i++){ scanf("%d%d",&a,&b); e[i].pb(a); w[i].pb(b); e[a].pb(i); w[a].pb(b); } scanf("%d",&q); for (int i=0;i<q;i++){ scanf("%d%d",&a,&b); g[a].pb(make_pair(b,i)); g[b].pb(make_pair(a,i)); } dfs(0,-1); for (int i=0;i<n;i++){ printf("%lld\n",d[i]); } memset(p,0,sizeof(p)); for (int i=0;i<n;i++){ f[i] = i; } for (int i=0;i<q;i++){ printf("%lld",ans[i]); if (i != q - 1){ printf(" "); } else { printf("\n"); } } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(void) { int i; int j; for(i = 1;i <= 9;i++){ for(j = 0;j <= 9;j++){ printf("%dx%d=%d\n", i, j, i * j); } } return (0); }s
Here is a piece of code written in C: #include<stdio.h> int main(void) { int i; int j; for(i = 1;i <= 9;i++){ for(j = 0;j <= 9;j++){ printf("%dx%d=%d\n", i, j, i * j); } } return (0); }s Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int d[1000000]; int main(void) { int n, m, p, pp, ppp; int i, j, x, y; int index, work, an1, an2, yen, yen2, yen3; int min, max, mid; int xx, yy; scanf("%d %d %d", &n, &m, &p); for (i = 0; i < m; i++){ scanf("%d", &d[i]); } for (an1 = 0; an1 < m; an1++) { index = an1; for (an2 = an1 + 1; an2 < m; an2++) { if (d[an2] < d[index]) { index = an2; } } work = d[an1]; d[an1] = d[index]; d[index] = work; } yen = 0; yen2 = 0; pp = p; ppp = p; for (i = 0; i < m; i++){ x = d[i] - p; if (x < 0){ x *= -1; } y = n - x; if (x >= y) { yen += y; p = d[i]; } else { yen += x; p = d[i]; } } for (i = m - 1; i >= 0; i--){ x = d[i] - pp; if (x < 0){ x *= -1; } y = n - x; if (x >= y) { yen2 += y; pp = d[i]; } else { yen2 += x; pp = d[i]; } } yen3 = 0; xx = 0; yy = m - 1; min = d[xx]; max = d[yy]; while (min <= max) { if (ppp > d[xx]) { x = n - (ppp - d[xx]); } else { x = d[xx] - ppp; } if (x < 0) { x *= -1; } if (ppp < d[xx] && (n - d[yy] + ppp) < 100) { y = n - d[yy] + ppp } else { y = d[yy] - ppp; } if (y < 0) { y *= -1; } if (x > y) { yen3 += y; ppp = d[yy]; yy--; } else { yen3 += x; ppp = d[xx]; xx++; } min = d[xx]; max = d[yy]; } if (yen <= yen2 && yen <= yen3){ printf("%d\n", yen * 100); } else if (yen2 <= yen && yen2 <= yen3){ printf("%d\n", yen2 * 100); } else if (yen3 <= yen && yen3 <= yen2){ printf("%d\n", yen3 * 100); } return (0); }
Here is a piece of code written in C: #include <stdio.h> int d[1000000]; int main(void) { int n, m, p, pp, ppp; int i, j, x, y; int index, work, an1, an2, yen, yen2, yen3; int min, max, mid; int xx, yy; scanf("%d %d %d", &n, &m, &p); for (i = 0; i < m; i++){ scanf("%d", &d[i]); } for (an1 = 0; an1 < m; an1++) { index = an1; for (an2 = an1 + 1; an2 < m; an2++) { if (d[an2] < d[index]) { index = an2; } } work = d[an1]; d[an1] = d[index]; d[index] = work; } yen = 0; yen2 = 0; pp = p; ppp = p; for (i = 0; i < m; i++){ x = d[i] - p; if (x < 0){ x *= -1; } y = n - x; if (x >= y) { yen += y; p = d[i]; } else { yen += x; p = d[i]; } } for (i = m - 1; i >= 0; i--){ x = d[i] - pp; if (x < 0){ x *= -1; } y = n - x; if (x >= y) { yen2 += y; pp = d[i]; } else { yen2 += x; pp = d[i]; } } yen3 = 0; xx = 0; yy = m - 1; min = d[xx]; max = d[yy]; while (min <= max) { if (ppp > d[xx]) { x = n - (ppp - d[xx]); } else { x = d[xx] - ppp; } if (x < 0) { x *= -1; } if (ppp < d[xx] && (n - d[yy] + ppp) < 100) { y = n - d[yy] + ppp } else { y = d[yy] - ppp; } if (y < 0) { y *= -1; } if (x > y) { yen3 += y; ppp = d[yy]; yy--; } else { yen3 += x; ppp = d[xx]; xx++; } min = d[xx]; max = d[yy]; } if (yen <= yen2 && yen <= yen3){ printf("%d\n", yen * 100); } else if (yen2 <= yen && yen2 <= yen3){ printf("%d\n", yen2 * 100); } else if (yen3 <= yen && yen3 <= yen2){ printf("%d\n", yen3 * 100); } return (0); } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<cstdio> main(){ }
Here is a piece of code written in C: #include<cstdio> main(){ } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void) { int c; for (int i=1; i<=9; i++){ for (int j=1; j<=9; j++){ printf("%dx%d=%d\n", i, j, i*j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(void) { int c; for (int i=1; i<=9; i++){ for (int j=1; j<=9; j++){ printf("%dx%d=%d\n", i, j, i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i,j; for(i=1;i<10;i++){ for(j=1;j<10;j++{ printf("%dx%d=%d",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ int i,j; for(i=1;i<10;i++){ for(j=1;j<10;j++{ printf("%dx%d=%d",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #define FOR( i,a ) for( i = 0;i < a;i++ ) int main(){  int i = 0,j = 0; FOR( i,10 ){ FOR( j,10 ){ printf( "%dx%d=%d",i,j,i*j ); }} return 0; }
Here is a piece of code written in C: #include<stdio.h> #define FOR( i,a ) for( i = 0;i < a;i++ ) int main(){  int i = 0,j = 0; FOR( i,10 ){ FOR( j,10 ){ printf( "%dx%d=%d",i,j,i*j ); }} return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main() { for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
null
Here is a piece of code written in C: null Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main() {int a,i,j; for(i=1;i<=9;i++) { for(j=1;j<=9;j++) { printf("%d x %d = %d",i,j,i*j); printf("\n"); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(){ for(int i = 1; i <= 9; i++){ for(int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(){ for(int i = 1; i <= 9; i++){ for(int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(){ for(int i = 1; i <= 9; i++){ for(int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(){ for(int i = 1; i <= 9; i++){ for(int j = 1; j <= 9; j++){ printf("%dx%d=%d\n", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
/* *********************************************** Author :CKboss Created Time :2015蟷エ01譛?7譌・ 譏滓悄蜈ュ 00譌カ19蛻?3遘?File Name :fenxi.cpp ************************************************ */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <set> #include <map> using namespace std; /// 33 KeyWords char KeyWord[35][10] = { "auto","break","case","char","const","continue", "default","do","double","else","enum","extern", "float","for","goto","if","int","long","bool", "register","return","short","signed","sizeof","static", "struct","switch","typedef","union","unsigned","void", "volatile","while"}; /// 21 sig char sig[22][5] = { "=","+","-","*","/","<","<=","!","&","|","~","^",">",">=","==",";","(",")","#","++","--" }; map<int,string> mis; /*****************ac********************************/ const int maxn = 1000; int ch[maxn][130],fail[maxn],end[maxn]; int root,sz; int newnode() { memset(ch[sz],-1,sizeof(ch[sz])); end[sz++]=0; return sz-1; } void ac_init() { sz=0; root = newnode(); } void insert(char str[],int id) { int len = strlen(str); int now = root; for(int i=0;i<len;i++) { int& temp = ch[now][(int)str[i]]; if(temp==-1) temp = newnode(); now = temp; } end[now]=id; } void build() { queue<int> q; fail[root] = root; for(int i=0;i<130;i++) { int& temp = ch[root][i]; if(temp==-1) temp = root; else { fail[temp]=root; q.push(temp); } } while(!q.empty()) { int now = q.front(); q.pop(); for(int i=0;i<130;i++) { if(ch[now][i]==-1) ch[now][i]=ch[fail[now]][i]; else { fail[ch[now][i]]=ch[fail[now]][i]; q.push(ch[now][i]); } } } } vector<int> vi; vector<int> pos; void query(char str[]) { int len = strlen(str); int now = root; int ret = 0; queue<int> qq; queue<int> ppp; for(int i=0;i<len;i++) { now = ch[now][(int)str[i]]; int temp = now; while(temp!=root&&end[temp]) { /// 謇セ蛻ー荳?クェ蜈ウ髞ョ蟄玲?閠?ョ玲惘隨ヲ蜿キ qq.push(end[temp]); ppp.push(i); temp = fail[temp]; } } while(!qq.empty()) { int f = qq.front(); qq.pop(); int p = ppp.front(); ppp.pop(); /// 蟇ケ >= <= == ++ -- 逧?愛譁ュ if(f==47||f==40||f==48||f==53||f==54) { vi.pop_back(); qq.pop(); pos.pop_back(); ppp.pop(); } /// do 蜥?double 逧?愛譁ュ if(f==9) { vi.pop_back(); pos.pop_back(); } vi.push_back(f); pos.push_back(p); } } /*****************ac********************************/ map<string,int> msi; map<string,int> mss; int Len[1000]; void init() { mis.clear(); msi.clear(); mss.clear(); ac_init(); for(int i=0;i<33;i++) { insert(KeyWord[i],i+1); msi[(string)KeyWord[i]]=i+1; mis[i+1]=KeyWord[i]; Len[i+1]=strlen(KeyWord[i]); } for(int i=0;i<21;i++) { insert(sig[i],i+34); mss[(string)sig[i]]=i+34; mis[i+34]=sig[i]; Len[i+34]=strlen(sig[i]); } build(); } bool isLetter(char c) { if((c>='a'&&c<='z')||(c>='A'&&c<='Z')) return true; else return false; } bool isDigit(char c) { if(c>='0'&&c<='9') return true; return false; } bool isEmpty(char c) { if(c=='\n'||c=='\t'||c==' ') return true; return false; } bool checkVar(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } int state = 0; if(isLetter(str[i])==true) state = 1,i++; else return false; for(;i<len;i++) { if(isDigit(str[i])==true||isLetter(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } bool checkInt(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } bool checkFloat(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } int state = 0; if(isDigit(str[i])==true) state = 1; else if(str[i]=='.') goto label; else return false; for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } label: if(str[i]=='.') state = 2,i++; else return false; for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } int checkOther(string str) /// 蜿倬? 1 謨エ謨ー 2 豬ョ轤ケ謨ー 3 譛ェ隸?悪 0 { bool fA=false; /// 蜷ォ譛牙ュ玲ッ? bool fB=false; /// 蜷ォ譛画焚蟄? bool fC=false; /// 蜷ォ譛? int len = str.length(); for(int i=0;i<len;i++) { if(isLetter(str[i])) fA=true; if(isDigit(str[i])) fB=true; if(str[i]=='.') fC=true; } if(fA)///蜷ォ譛牙ュ玲ッ肴」?衍譏ッ蜷ヲ譏ッ蜿倬? { if(checkVar(str)) return 1; else return 0; } else { if(fC) { if(checkFloat(str)) return 3; else return 0; } else { if(checkInt(str)) return 2; else return 0; } } return 0; } int INT = 0, FLOAT = 0 , VAR = 0; int NUM[100]; void solve(char* st) { int sz= vi.size(); int lastpos=0; string str = st; string temp ; int len = str.length(); for(int i=0;i<sz;i++) { int beg = pos[i]+1-Len[vi[i]]; int end = pos[i]; int id = vi[i]; /// 蟇ケ蠑?、エ蜥御クュ髣エ譽?衍 if(beg==lastpos) ; else { int from = lastpos,to = beg-1; temp=str.substr(from,to-from+1); int kind = checkOther(temp); if(kind==1) cout<<"( "<<temp<<" , 蜿倬?)"<<endl; else if(kind==2) cout<<"( "<<temp<<" , 謨エ謨ー)"<<endl; else if(kind==3) cout<<"( "<<temp<<" , 豬ョ轤ケ謨ー)"<<endl; else if(kind==0) cout<<"( "<<temp<<" , 譛ェ隸?悪)"<<endl; } temp=str.substr(beg,end-beg+1); if(id<34) cout<<"( "<<temp<<" , 蜈ウ髞ョ蟄?"<<mis[id]<<++NUM[id]<<" )"<<endl; else cout<<"( "<<temp<<" , 隨ヲ蜿キ "<<mis[id]<<++NUM[id]<<" )"<<endl; if(i==sz-1)///蟇ケ扈灘ーセ譽?衍 { if(end==len-1) ; else { int from = lastpos,to = len-1; int kind = checkOther(temp); if(kind==1) cout<<"( "<<temp<<" , 蜿倬?)"<<endl; else if(kind==2) cout<<"( "<<temp<<" , 謨エ謨ー)"<<endl; else if(kind==3) cout<<"( "<<temp<<" , 豬ョ轤ケ謨ー)"<<endl; else if(kind==0) cout<<"( "<<temp<<" , 譛ェ隸?悪)"<<endl; } } lastpos=end+1; } } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); init(); char str[100]; memset(NUM,0,sizeof(NUM)); VAR=0;INT=0;FLOAT=0; while(cin>>str) { vi.clear(); pos.clear(); query(str); solve(str); } return 0; }
Here is a piece of code written in C: /* *********************************************** Author :CKboss Created Time :2015蟷エ01譛?7譌・ 譏滓悄蜈ュ 00譌カ19蛻?3遘?File Name :fenxi.cpp ************************************************ */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <set> #include <map> using namespace std; /// 33 KeyWords char KeyWord[35][10] = { "auto","break","case","char","const","continue", "default","do","double","else","enum","extern", "float","for","goto","if","int","long","bool", "register","return","short","signed","sizeof","static", "struct","switch","typedef","union","unsigned","void", "volatile","while"}; /// 21 sig char sig[22][5] = { "=","+","-","*","/","<","<=","!","&","|","~","^",">",">=","==",";","(",")","#","++","--" }; map<int,string> mis; /*****************ac********************************/ const int maxn = 1000; int ch[maxn][130],fail[maxn],end[maxn]; int root,sz; int newnode() { memset(ch[sz],-1,sizeof(ch[sz])); end[sz++]=0; return sz-1; } void ac_init() { sz=0; root = newnode(); } void insert(char str[],int id) { int len = strlen(str); int now = root; for(int i=0;i<len;i++) { int& temp = ch[now][(int)str[i]]; if(temp==-1) temp = newnode(); now = temp; } end[now]=id; } void build() { queue<int> q; fail[root] = root; for(int i=0;i<130;i++) { int& temp = ch[root][i]; if(temp==-1) temp = root; else { fail[temp]=root; q.push(temp); } } while(!q.empty()) { int now = q.front(); q.pop(); for(int i=0;i<130;i++) { if(ch[now][i]==-1) ch[now][i]=ch[fail[now]][i]; else { fail[ch[now][i]]=ch[fail[now]][i]; q.push(ch[now][i]); } } } } vector<int> vi; vector<int> pos; void query(char str[]) { int len = strlen(str); int now = root; int ret = 0; queue<int> qq; queue<int> ppp; for(int i=0;i<len;i++) { now = ch[now][(int)str[i]]; int temp = now; while(temp!=root&&end[temp]) { /// 謇セ蛻ー荳?クェ蜈ウ髞ョ蟄玲?閠?ョ玲惘隨ヲ蜿キ qq.push(end[temp]); ppp.push(i); temp = fail[temp]; } } while(!qq.empty()) { int f = qq.front(); qq.pop(); int p = ppp.front(); ppp.pop(); /// 蟇ケ >= <= == ++ -- 逧?愛譁ュ if(f==47||f==40||f==48||f==53||f==54) { vi.pop_back(); qq.pop(); pos.pop_back(); ppp.pop(); } /// do 蜥?double 逧?愛譁ュ if(f==9) { vi.pop_back(); pos.pop_back(); } vi.push_back(f); pos.push_back(p); } } /*****************ac********************************/ map<string,int> msi; map<string,int> mss; int Len[1000]; void init() { mis.clear(); msi.clear(); mss.clear(); ac_init(); for(int i=0;i<33;i++) { insert(KeyWord[i],i+1); msi[(string)KeyWord[i]]=i+1; mis[i+1]=KeyWord[i]; Len[i+1]=strlen(KeyWord[i]); } for(int i=0;i<21;i++) { insert(sig[i],i+34); mss[(string)sig[i]]=i+34; mis[i+34]=sig[i]; Len[i+34]=strlen(sig[i]); } build(); } bool isLetter(char c) { if((c>='a'&&c<='z')||(c>='A'&&c<='Z')) return true; else return false; } bool isDigit(char c) { if(c>='0'&&c<='9') return true; return false; } bool isEmpty(char c) { if(c=='\n'||c=='\t'||c==' ') return true; return false; } bool checkVar(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } int state = 0; if(isLetter(str[i])==true) state = 1,i++; else return false; for(;i<len;i++) { if(isDigit(str[i])==true||isLetter(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } bool checkInt(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } bool checkFloat(string str) { int len = str.length(),i=0; while(isEmpty(str[i])) { i++; continue; } int state = 0; if(isDigit(str[i])==true) state = 1; else if(str[i]=='.') goto label; else return false; for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } label: if(str[i]=='.') state = 2,i++; else return false; for(;i<len;i++) { if(isDigit(str[i])==true) continue; else break; } bool flag=true; for(;i<len;i++) { if(isEmpty(str[i])) continue; else { flag=false; break; } } return flag; } int checkOther(string str) /// 蜿倬? 1 謨エ謨ー 2 豬ョ轤ケ謨ー 3 譛ェ隸?悪 0 { bool fA=false; /// 蜷ォ譛牙ュ玲ッ? bool fB=false; /// 蜷ォ譛画焚蟄? bool fC=false; /// 蜷ォ譛? int len = str.length(); for(int i=0;i<len;i++) { if(isLetter(str[i])) fA=true; if(isDigit(str[i])) fB=true; if(str[i]=='.') fC=true; } if(fA)///蜷ォ譛牙ュ玲ッ肴」?衍譏ッ蜷ヲ譏ッ蜿倬? { if(checkVar(str)) return 1; else return 0; } else { if(fC) { if(checkFloat(str)) return 3; else return 0; } else { if(checkInt(str)) return 2; else return 0; } } return 0; } int INT = 0, FLOAT = 0 , VAR = 0; int NUM[100]; void solve(char* st) { int sz= vi.size(); int lastpos=0; string str = st; string temp ; int len = str.length(); for(int i=0;i<sz;i++) { int beg = pos[i]+1-Len[vi[i]]; int end = pos[i]; int id = vi[i]; /// 蟇ケ蠑?、エ蜥御クュ髣エ譽?衍 if(beg==lastpos) ; else { int from = lastpos,to = beg-1; temp=str.substr(from,to-from+1); int kind = checkOther(temp); if(kind==1) cout<<"( "<<temp<<" , 蜿倬?)"<<endl; else if(kind==2) cout<<"( "<<temp<<" , 謨エ謨ー)"<<endl; else if(kind==3) cout<<"( "<<temp<<" , 豬ョ轤ケ謨ー)"<<endl; else if(kind==0) cout<<"( "<<temp<<" , 譛ェ隸?悪)"<<endl; } temp=str.substr(beg,end-beg+1); if(id<34) cout<<"( "<<temp<<" , 蜈ウ髞ョ蟄?"<<mis[id]<<++NUM[id]<<" )"<<endl; else cout<<"( "<<temp<<" , 隨ヲ蜿キ "<<mis[id]<<++NUM[id]<<" )"<<endl; if(i==sz-1)///蟇ケ扈灘ーセ譽?衍 { if(end==len-1) ; else { int from = lastpos,to = len-1; int kind = checkOther(temp); if(kind==1) cout<<"( "<<temp<<" , 蜿倬?)"<<endl; else if(kind==2) cout<<"( "<<temp<<" , 謨エ謨ー)"<<endl; else if(kind==3) cout<<"( "<<temp<<" , 豬ョ轤ケ謨ー)"<<endl; else if(kind==0) cout<<"( "<<temp<<" , 譛ェ隸?悪)"<<endl; } } lastpos=end+1; } } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); init(); char str[100]; memset(NUM,0,sizeof(NUM)); VAR=0;INT=0;FLOAT=0; while(cin>>str) { vi.clear(); pos.clear(); query(str); solve(str); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> int main(){for(int i=1;i<10;i++)for(int j=1;j<10;j++)printf("%dx%d=%d\n",i,j,i*j);return 0;}
Here is a piece of code written in C: #include <iostream> int main(){for(int i=1;i<10;i++)for(int j=1;j<10;j++)printf("%dx%d=%d\n",i,j,i*j);return 0;} Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main() { int i, j; for(i=1; i<10; i++) { for(j=1; j<10; i++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main() { int i, j; for(i=1; i<10; i++) { for(j=1; j<10; i++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
a
Here is a piece of code written in C: a Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%d×%d=%d\n",i,j,i*j) } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%d×%d=%d\n",i,j,i*j) } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%d×%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%d×%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for( int i = 1; i <= 9; i++ ){ for( int j = 1; j <= 9; j++ ){ printf("%dx%d=%d", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for( int i = 1; i <= 9; i++ ){ for( int j = 1; j <= 9; j++ ){ printf("%dx%d=%d", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
/* *********************************************** Author :CKboss Created Time :2015蟷エ04譛?1譌・ 譏滓悄荳?19譌カ00蛻?7遘?File Name :CF514E.cpp ************************************************ */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <set> #include <map> using namespace std; typedef long long int LL; const LL mod = 1e9+7; const LL maxn = 100100; LL n,x; LL dist[maxn]; LL dp[120],cnt[120]; struct Matrix { LL m[110][110]; void initB() { memset(m,0,sizeof(m)); for(LL i=0;i<100;i++) m[i][99]=m[i][100]=cnt[100-i]; m[100][100]=1; for(LL i=1;i<100;i++) m[i][i-1]=1; } void initE() { memset(m,0,sizeof(m)); for(LL i=0;i<=101;i++) m[i][i]=1; } }; Matrix Cheng(const Matrix& A,const Matrix& B) { Matrix ret ; for(LL i=0;i<101;i++) { for(LL j=0;j<101;j++) { for(LL k=0;k<101;k++) { ret.m[i][j]=(ret.m[i][j]+(A.m[i][k]*B.m[k][j])%mod)%mod; } } } return ret; } void shoWM(Matrix a) { cout<<"show it: \n"; for(int i=0;i<2;i++) { for(int j=0;j<2;j++) cout<<a.m[i][j]<<" "; cout<<endl; } } Matrix QuickPow(Matrix M,LL n) { Matrix E; E.initE(); while(n) { cout<<"n: "<<n<<endl; if(n&1LL) { cout<<" xiang cheng "<<endl; E=Cheng(E,M); } shoWM(M); shoWM(E); M=Cheng(M,M); n/=2LL; } return E; } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); Matrix E; E.m[0][0]=1; E.m[1][1]=1; Matrix M; M.m[0][0]=2; M.m[0][1]=1; M.m[1][0]=1; M.m[1][1]=1; Matrix D; D.m[0][0]=1; D.m[0][1]=1; D.m[1][0]=1; D.m[1][1]=0; Matrix A; A.m[0][0]=2; A.m[0][1]=1; A.m[1][0]=1; A.m[1][1]=1; Matrix C = QuickPow(D,2); //Matrix C = E*M; //A=Cheng(A,A); shoWM(C); return 0; cin>>n>>x; for(LL i=0;i<n;i++) { cin>>dist[i]; cnt[dist[i]]++; } dp[0]=1; for(LL i=1;i<=100;i++) for(LL j=1;j<=i;j++) dp[i]=(dp[i]+(cnt[j]*dp[i-j])%mod)%mod; LL ans=0; if(x<=100) { for(LL i=0;i<=x;i++) ans=(ans+dp[i])%mod; } else { Matrix B; B.initB(); /* for(int i=0;i<=100;i++) { for(int j=0;j<=100;j++) cout<<B.m[i][j]<<" "; cout<<endl; } */ Matrix mat = QuickPow(B,x-100); LL sum=0; for(LL i=0;i<=100;i++) sum=(sum+dp[i])%mod; dp[101]=sum; //for(int i=0;i<=101;i++) cout<<dp[i]<<","; cout<<endl; /* for(int i=0;i<=100;i++) { for(int j=0;j<=100;j++) cout<<mat.m[i][j]<<" "; cout<<endl; } */ for(LL i=0;i<=100;i++) { ans=(ans+(dp[i+1]*mat.m[i][100])%mod)%mod; } ans=(ans+sum)%mod; } cout<<ans<<endl; return 0; }
Here is a piece of code written in C: /* *********************************************** Author :CKboss Created Time :2015蟷エ04譛?1譌・ 譏滓悄荳?19譌カ00蛻?7遘?File Name :CF514E.cpp ************************************************ */ #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <cmath> #include <cstdlib> #include <vector> #include <queue> #include <set> #include <map> using namespace std; typedef long long int LL; const LL mod = 1e9+7; const LL maxn = 100100; LL n,x; LL dist[maxn]; LL dp[120],cnt[120]; struct Matrix { LL m[110][110]; void initB() { memset(m,0,sizeof(m)); for(LL i=0;i<100;i++) m[i][99]=m[i][100]=cnt[100-i]; m[100][100]=1; for(LL i=1;i<100;i++) m[i][i-1]=1; } void initE() { memset(m,0,sizeof(m)); for(LL i=0;i<=101;i++) m[i][i]=1; } }; Matrix Cheng(const Matrix& A,const Matrix& B) { Matrix ret ; for(LL i=0;i<101;i++) { for(LL j=0;j<101;j++) { for(LL k=0;k<101;k++) { ret.m[i][j]=(ret.m[i][j]+(A.m[i][k]*B.m[k][j])%mod)%mod; } } } return ret; } void shoWM(Matrix a) { cout<<"show it: \n"; for(int i=0;i<2;i++) { for(int j=0;j<2;j++) cout<<a.m[i][j]<<" "; cout<<endl; } } Matrix QuickPow(Matrix M,LL n) { Matrix E; E.initE(); while(n) { cout<<"n: "<<n<<endl; if(n&1LL) { cout<<" xiang cheng "<<endl; E=Cheng(E,M); } shoWM(M); shoWM(E); M=Cheng(M,M); n/=2LL; } return E; } int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); Matrix E; E.m[0][0]=1; E.m[1][1]=1; Matrix M; M.m[0][0]=2; M.m[0][1]=1; M.m[1][0]=1; M.m[1][1]=1; Matrix D; D.m[0][0]=1; D.m[0][1]=1; D.m[1][0]=1; D.m[1][1]=0; Matrix A; A.m[0][0]=2; A.m[0][1]=1; A.m[1][0]=1; A.m[1][1]=1; Matrix C = QuickPow(D,2); //Matrix C = E*M; //A=Cheng(A,A); shoWM(C); return 0; cin>>n>>x; for(LL i=0;i<n;i++) { cin>>dist[i]; cnt[dist[i]]++; } dp[0]=1; for(LL i=1;i<=100;i++) for(LL j=1;j<=i;j++) dp[i]=(dp[i]+(cnt[j]*dp[i-j])%mod)%mod; LL ans=0; if(x<=100) { for(LL i=0;i<=x;i++) ans=(ans+dp[i])%mod; } else { Matrix B; B.initB(); /* for(int i=0;i<=100;i++) { for(int j=0;j<=100;j++) cout<<B.m[i][j]<<" "; cout<<endl; } */ Matrix mat = QuickPow(B,x-100); LL sum=0; for(LL i=0;i<=100;i++) sum=(sum+dp[i])%mod; dp[101]=sum; //for(int i=0;i<=101;i++) cout<<dp[i]<<","; cout<<endl; /* for(int i=0;i<=100;i++) { for(int j=0;j<=100;j++) cout<<mat.m[i][j]<<" "; cout<<endl; } */ for(LL i=0;i<=100;i++) { ans=(ans+(dp[i+1]*mat.m[i][100])%mod)%mod; } ans=(ans+sum)%mod; } cout<<ans<<endl; return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
test
Here is a piece of code written in C: test Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
test
Here is a piece of code written in C: test Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
@0000.cpp
Here is a piece of code written in C: @0000.cpp Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i) { for(int j = 1; j <= 9; j) { cout << i << "x" << j << "=" << i*j << endl; } } return 0; }
Here is a piece of code written in C: #include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i) { for(int j = 1; j <= 9; j) { cout << i << "x" << j << "=" << i*j << endl; } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
sourceCode
Here is a piece of code written in C: sourceCode Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i) { for(int j = 1; j <= 9; j) { cout << i << "x" << j << "=" << i*j << endl; } } return 0; }
Here is a piece of code written in C: #include <iostream> using namespace std; int main() { for(int i = 1; i <= 9; i) { for(int j = 1; j <= 9; j) { cout << i << "x" << j << "=" << i*j << endl; } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { printf("%dx%d\n",i,j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { printf("%dx%d\n",i,j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #include<stdlib.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } system("pause"); return 0; }
Here is a piece of code written in C: #include<stdio.h> #include<stdlib.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } system("pause"); return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> #include<stdlib.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> #include<stdlib.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d", i, j, i * j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { printf("%dx%d=%d", i, j, i * j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { if (i == 9 && j == 9) { printf("%dx%d=%d", i, j, i * j); } else { printf("%dx%d=%d\n", i, j, i * j); } } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 1; i < 10; i++) { for (int j = 1; j < 10; j++) { if (i == 9 && j == 9) { printf("%dx%d=%d", i, j, i * j); } else { printf("%dx%d=%d\n", i, j, i * j); } } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void) { for( int i = 1; i <= 9; i++ ) { for( int j = 1; j <= 9; j++ ) { printf( "%dx%d=%d\n", i, j, i*j ); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(void) { for( int i = 1; i <= 9; i++ ) { for( int j = 1; j <= 9; j++ ) { printf( "%dx%d=%d\n", i, j, i*j ); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> int main(){ int x,y; int i,j; for(i=1; i<10; i++){ for(j=1; j<10; j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: include<stdio.h> int main(){ int x,y; int i,j; for(i=1; i<10; i++){ for(j=1; j<10; j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> int main(){ int x,y; int i,j; for(i=1; i<10; i++){ for(j=1; j<10; j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: include<stdio.h> int main(){ int x,y; int i,j; for(i=1; i<10; i++){ for(j=1; j<10; j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
package com.degree45; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.net.*; import java.util.*; import org.dom4j.*; import org.dom4j.io.OutputFormat; import org.dom4j.io.SAXReader; import org.dom4j.io.*; public class XML_Account { private Document doc; private String url; public XML_Account(String u) { // TODO Auto-generated constructor stub url=u; try { doc = getDoc(url); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Document getDoc(String url) throws DocumentException{ SAXReader reader = new SAXReader(); Document document = reader.read(url); return document; } public void bar(Document doc) { Element root = doc.getRootElement(); System.out.println("root: "+root.getName()); for(Iterator i=root.elementIterator();i.hasNext();){ Element element = (Element) i.next(); String name = element.elementText("username"); String pass = element.elementText("password"); System.out.println(element.getName()+","+name+","+pass); } } public boolean findAccount(int kind,String name,String passwd){ Element root = doc.getRootElement(); for(Iterator i=root.elementIterator();i.hasNext();){ Element element=(Element)i.next(); if(element.elementText("username").equals(name)){ if(kind==0) { if(element.elementText("password").equals(passwd)) return true; return false; } else if(kind==1){ return true; } } } return false; } public void addAccount(String name,String passwd){ Element root = doc.getRootElement(); Element e = root.addElement("account"); e.addElement("username").addText(name); e.addElement("password").addText(passwd); try { XMLWriter writer; writer = new XMLWriter(new FileWriter( url )); writer.write( doc ); writer.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } public static void main(String[] args) { // TODO Auto-generated method stub XML_Account xa = new XML_Account("./WebRoot/WEB-INF/Accounts/BlackAccounts.xml"); System.out.println("---> "+xa.findAccount(1,"bigming","123")); xa.bar(xa.doc); System.out.println("All Right"); } }
Here is a piece of code written in C: package com.degree45; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.net.*; import java.util.*; import org.dom4j.*; import org.dom4j.io.OutputFormat; import org.dom4j.io.SAXReader; import org.dom4j.io.*; public class XML_Account { private Document doc; private String url; public XML_Account(String u) { // TODO Auto-generated constructor stub url=u; try { doc = getDoc(url); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public Document getDoc(String url) throws DocumentException{ SAXReader reader = new SAXReader(); Document document = reader.read(url); return document; } public void bar(Document doc) { Element root = doc.getRootElement(); System.out.println("root: "+root.getName()); for(Iterator i=root.elementIterator();i.hasNext();){ Element element = (Element) i.next(); String name = element.elementText("username"); String pass = element.elementText("password"); System.out.println(element.getName()+","+name+","+pass); } } public boolean findAccount(int kind,String name,String passwd){ Element root = doc.getRootElement(); for(Iterator i=root.elementIterator();i.hasNext();){ Element element=(Element)i.next(); if(element.elementText("username").equals(name)){ if(kind==0) { if(element.elementText("password").equals(passwd)) return true; return false; } else if(kind==1){ return true; } } } return false; } public void addAccount(String name,String passwd){ Element root = doc.getRootElement(); Element e = root.addElement("account"); e.addElement("username").addText(name); e.addElement("password").addText(passwd); try { XMLWriter writer; writer = new XMLWriter(new FileWriter( url )); writer.write( doc ); writer.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } public static void main(String[] args) { // TODO Auto-generated method stub XML_Account xa = new XML_Account("./WebRoot/WEB-INF/Accounts/BlackAccounts.xml"); System.out.println("---> "+xa.findAccount(1,"bigming","123")); xa.bar(xa.doc); System.out.println("All Right"); } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 9; j++) { printf("%dx%d=%d\n", i, j, i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<cstdio> #include<algorithm> #include<set> using namespace std; struct Point { int x, y; Point(int x = 0, int y = 0) : x(x), y(y){} bool operator < (const Point t) const{ if(x != t.x) return x < t.x; return y < t.y; } }; int main() { int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); set<Point> fruit[n]; for(int i = 0 ; i < n ; i++) { int k; scanf("%d", &k); int x, y; for(int j = 0 ; j < k ; j++) { scanf("%d%d", x, y); fruit[i].insert(Point(x, y)); } } } return 0; }
Here is a piece of code written in C: #include<cstdio> #include<algorithm> #include<set> using namespace std; struct Point { int x, y; Point(int x = 0, int y = 0) : x(x), y(y){} bool operator < (const Point t) const{ if(x != t.x) return x < t.x; return y < t.y; } }; int main() { int T; scanf("%d", &T); while(T--) { int n; scanf("%d", &n); set<Point> fruit[n]; for(int i = 0 ; i < n ; i++) { int k; scanf("%d", &k); int x, y; for(int j = 0 ; j < k ; j++) { scanf("%d%d", x, y); fruit[i].insert(Point(x, y)); } } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } }
Here is a piece of code written in C: #include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1 ;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } } } ~
Here is a piece of code written in C: #include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1 ;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } } } ~ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1 ;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } } } ~
Here is a piece of code written in C: #include<stdio.h> int main(){ int i; int j; int seki; for(i=1;i<10;i++){ for(j=1 ;j<10;j++){ seki = i*j; printf("%dx%d=%d\n",i,j,seki); } } } ~ Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> int main(){ int i,j; for(i=1;i<=9;i++){ for(j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: include<stdio.h> int main(){ int i,j; for(i=1;i<=9;i++){ for(j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
####索引 **** ```sql create table TD( id number, sq number, tri number, fac number, fib number, pow number ); create or replace procedure proce1 AS id number:=1; last1 number:=0; last2 number:=1; lastpow number:=1; lastfac number:=1; md number:=1000003; temp number; begin for i in 1..100000 loop insert into TD values ( i,MOD((i*i),md),MOD((i*i*i),md),Mod(lastfac*i,md) ,Mod(last1+last2,md),Mod(lastpow*2,md)); temp:=last1; last1:=last2; last2:=Mod(temp+last1,md); lastpow:=Mod(lastpow*2,md); lastfac:=Mod(lastfac*i,md); end loop; end; create index myindex1 on TD(id); ``` * ??比?,索引???速度?快了一点. <br> ####数据字典表 **** #### PL/SQL 程序基? **** * 判断偶数 ```sql create or replace procedure pro1 (x number) as begin if Mod(x,2)=0 then dbms_output.put_line('even'); else dbms_output.put_line('odd'); end if; end; ``` * 判断素数 ```sql create or replace procedure isPrime(x number) as flag number:=1; begin if x<2 then dbms_output.put_line('not prime'); else for i in 2..x loop if i*i>x then goto here; end if; if Mod(x,i)=0 then flag:=0; goto here; end if; end loop; <<here>> if flag=1 then dbms_output.put_line('is prime'); else dbms_output.put_line('not prime'); end if; end if; end; ```
Here is a piece of code written in C: ####索引 **** ```sql create table TD( id number, sq number, tri number, fac number, fib number, pow number ); create or replace procedure proce1 AS id number:=1; last1 number:=0; last2 number:=1; lastpow number:=1; lastfac number:=1; md number:=1000003; temp number; begin for i in 1..100000 loop insert into TD values ( i,MOD((i*i),md),MOD((i*i*i),md),Mod(lastfac*i,md) ,Mod(last1+last2,md),Mod(lastpow*2,md)); temp:=last1; last1:=last2; last2:=Mod(temp+last1,md); lastpow:=Mod(lastpow*2,md); lastfac:=Mod(lastfac*i,md); end loop; end; create index myindex1 on TD(id); ``` * ??比?,索引???速度?快了一点. <br> ####数据字典表 **** #### PL/SQL 程序基? **** * 判断偶数 ```sql create or replace procedure pro1 (x number) as begin if Mod(x,2)=0 then dbms_output.put_line('even'); else dbms_output.put_line('odd'); end if; end; ``` * 判断素数 ```sql create or replace procedure isPrime(x number) as flag number:=1; begin if x<2 then dbms_output.put_line('not prime'); else for i in 2..x loop if i*i>x then goto here; end if; if Mod(x,i)=0 then flag:=0; goto here; end if; end loop; <<here>> if flag=1 then dbms_output.put_line('is prime'); else dbms_output.put_line('not prime'); end if; end if; end; ``` Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i,j,sum; sum=0; for(i=0;i<10;i++){ for(j=0;j<10;j++){ sum=i*j; printf(i+"x"+j+"="+sum\n); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ int i,j,sum; sum=0; for(i=0;i<10;i++){ for(j=0;j<10;j++){ sum=i*j; printf(i+"x"+j+"="+sum\n); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i=1; i<=9; i++) { for (int j=1; j<=9; j++) printf("%dx%d=%d\n", i,j,i*j); } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i=1; i<=9; i++) { for (int j=1; j<=9; j++) printf("%dx%d=%d\n", i,j,i*j); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for (int i=1; i<=9; i++) { for (int j=1; j<=9; j++) { printf("%dx%d=%d\n", i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for (int i=1; i<=9; i++) { for (int j=1; j<=9; j++) { printf("%dx%d=%d\n", i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> int main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; }
Here is a piece of code written in C: include<stdio.h> int main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; }
Here is a piece of code written in C: include<stdio.h> main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for(int i=1; i<=9; i++){ for(int j=1; j<=9; j++){ printf("%dx%d=%d\n", i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main(void){ int i = j = 0; for(i = 1;i <= 9;i++){ for(j = 1;j <= 9;j++){ printf("%dx%d=%d\n", i, j, i*j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main(void){ int i = j = 0; for(i = 1;i <= 9;i++){ for(j = 1;j <= 9;j++){ printf("%dx%d=%d\n", i, j, i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include <stdio.h> int main() { for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; }
Here is a piece of code written in C: #include <stdio.h> int main() { for(int i=1;i<=9;i++){ for(int j=1;j<=9;j++){ printf("%dx%d=%d\n",i,j,i*j); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(int argc,const char *argv[]){ int i,j; for(i=1;i<=9;i++){ for(j=1;i<=9;i++){ printf("%d??%d=%d",i,j,seki); } printf("\n"); } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(int argc,const char *argv[]){ int i,j; for(i=1;i<=9;i++){ for(j=1;i<=9;i++){ printf("%d??%d=%d",i,j,seki); } printf("\n"); } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int i,j; for(i=1; i<=9; i++) { for(j=1; j<=9; j++){ System.out.println(i+"x"+j+"="+i*j); } } } }
Here is a piece of code written in C: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in=new Scanner(System.in); int i,j; for(i=1; i<=9; i++) { for(j=1; j<=9; j++){ System.out.println(i+"x"+j+"="+i*j); } } } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in=new Scanner(System.in); int i,j; for(i=1; i<=9; i++) { for(j=1; j<=9; j++){ System.out.println(i+"x"+j+"="+i*j); } } } }
Here is a piece of code written in C: import java.util.Scanner; public class Solution { public static void main(String[] args) { Scanner in=new Scanner(System.in); int i,j; for(i=1; i<=9; i++) { for(j=1; j<=9; j++){ System.out.println(i+"x"+j+"="+i*j); } } } } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
select stu.GRADE,stu.SEX,inj.KIND_ID,count(*) from REGISTERATION as reg join STUDENT as stu join INJURE as inj where reg.STUDENT = stu.S_ID and reg.INJURE = inj.KIND_ID group by stu.GRADE , stu.SEX , inj.KIND_ID with rollup;
Here is a piece of code written in C: select stu.GRADE,stu.SEX,inj.KIND_ID,count(*) from REGISTERATION as reg join STUDENT as stu join INJURE as inj where reg.STUDENT = stu.S_ID and reg.INJURE = inj.KIND_ID group by stu.GRADE , stu.SEX , inj.KIND_ID with rollup; Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ int i,j; for(i = 1; i < 10; i++){ for(j = 1; j < 10; j++){ printf(i + "*" + j + "=" + i*j + "\n"); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ int i,j; for(i = 1; i < 10; i++){ for(j = 1; j < 10; j++){ printf(i + "*" + j + "=" + i*j + "\n"); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
include<stdio.h> int main(void){ for(a=1;a<10;a++){ for(b=1;b<10;b++){ printf("%dx%d\n",a,b); } } return 0; }
Here is a piece of code written in C: include<stdio.h> int main(void){ for(a=1;a<10;a++){ for(b=1;b<10;b++){ printf("%dx%d\n",a,b); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No
p00000
C
Compile Error
#include<stdio.h> int main(){ for(i=0;i<10;i++;){ for(j=0;j<10;j++;){ y=i*j; printf(i "x" j "=" y); } } return 0; }
Here is a piece of code written in C: #include<stdio.h> int main(){ for(i=0;i<10;i++;){ for(j=0;j<10;j++;){ y=i*j; printf(i "x" j "=" y); } } return 0; } Do you think this code will compile successfully? Answer 'Yes' or 'No'.
No