submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s784372446
p00427
C
#include <stdio.h> #include <string.h> int main(void) { int i, j; int n, k, m, r; __int64 syou, amari; static int farray[10021], sum[10021]; while (1){ scanf("%d%d%d%d", &n, &k, &m, &r); if (n + k + m + r == 0){ break; } if (m == 0){ amari = 1; syou = n; printf("%d.", amari / syou); amari %= syou; amari *= 10; for (i = 0; i < r; i++){ printf("%d", amari / syou); amari %= syou; amari *= 10; } } else { memset(sum, 0, sizeof(sum)); for (i = 0; i < n; i++){ amari = 1; syou = (i == 0 ? n : n * i); memset(farray, 0, sizeof(farray)); for (j = 0; j <= 10020; j++){ farray[j] = amari / syou; amari %= syou; amari *= 10; } if (i == 0){ memcpy(sum, farray, sizeof(farray)); } else { for (j = 10020; j >= 0; j--){ sum[j] += farray[j]; if (sum[j] > 9){ sum[j] -= 10; sum[j - 1] += 1; } } } } printf("%d.", sum[0]); for (i = 1; i <= r; i++){ printf("%d", sum[i]); } } printf("\n"); } return (0); }
main.c: In function 'main': main.c:8:5: error: unknown type name '__int64'; did you mean '__int64_t'? 8 | __int64 syou, amari; | ^~~~~~~ | __int64_t
s789580305
p00427
C++
import java.lang.*; import java.lang.Number.*; import java.math.*; import java.util.*; class RealNumber{ // a/b public BigInteger a; public BigInteger b; public RealNumber(BigInteger aa, BigInteger bb){ a = aa; b = bb; } public RealNumber(String sa, String sb){ a = new BigInteger(sa); b = new BigInteger(sb); } public void add(RealNumber r){ BigInteger G=b.gcd(r.b); BigInteger tmpb=b.multiply(r.b.divide(G)); a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); b=tmpb; } public BigDecimal toBigDecimal(int r){ BigDecimal ret = new BigDecimal(a); ret = ret.divide(new BigDecimal(b),r,BigDecimal.ROUND_DOWN); return ret; } public void out(){ System.out.println(a+" / " +b); } } class Main{ public static void main(String []s ){ Scanner sc = new Scanner(System.in); RealNumber table[] = new RealNumber[10001]; RealNumber R = new RealNumber(new BigInteger("1"),new BigInteger("1")); table[1]=R; for(int i = 2; i < 10001; ++i){ R.add( new RealNumber(Integer.toString(1),Integer.toString(i)) ); table[i]=R; } while(true){ int n,k,m,r; BigDecimal ans=new BigDecimal(0); n = sc.nextInt(); k = sc.nextInt(); m = sc.nextInt(); r = sc.nextInt(); if(n==0&&k==0&&m==0&&r==0)break; BigDecimal bdn = new BigDecimal(n); if(m == 0){ ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); }else{ ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); BigDecimal bdtmp = new BigDecimal(table[n-1].a); bdtmp = bdtmp.divide( new BigDecimal(table[n-1].b), r+10, BigDecimal.ROUND_DOWN); bdtmp = bdtmp.multiply(ans); ans = ans.add(bdtmp); } System.out.println( ans.divide(BigDecimal.ONE,r,BigDecimal.ROUND_DOWN) ); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.lang.*; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.lang.Number.*; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.math.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:4:1: error: 'import' does not name a type 4 | import java.util.*; | ^~~~~~ a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:7:11: error: expected ':' before 'BigInteger' 7 | public BigInteger a; | ^~~~~~~~~~~ | : a.cc:7:12: error: 'BigInteger' does not name a type 7 | public BigInteger a; | ^~~~~~~~~~ a.cc:8:11: error: expected ':' before 'BigInteger' 8 | public BigInteger b; | ^~~~~~~~~~~ | : a.cc:8:12: error: 'BigInteger' does not name a type 8 | public BigInteger b; | ^~~~~~~~~~ a.cc:9:11: error: expected ':' before 'RealNumber' 9 | public RealNumber(BigInteger aa, BigInteger bb){ | ^~~~~~~~~~~ | : a.cc:9:33: error: expected ')' before 'aa' 9 | public RealNumber(BigInteger aa, BigInteger bb){ | ~ ^~~ | ) a.cc:13:11: error: expected ':' before 'RealNumber' 13 | public RealNumber(String sa, String sb){ | ^~~~~~~~~~~ | : a.cc:13:29: error: expected ')' before 'sa' 13 | public RealNumber(String sa, String sb){ | ~ ^~~ | ) a.cc:17:11: error: expected ':' before 'void' 17 | public void add(RealNumber r){ | ^~~~~ | : a.cc:23:11: error: expected ':' before 'BigDecimal' 23 | public BigDecimal toBigDecimal(int r){ | ^~~~~~~~~~~ | : a.cc:23:12: error: 'BigDecimal' does not name a type 23 | public BigDecimal toBigDecimal(int r){ | ^~~~~~~~~~ a.cc:28:11: error: expected ':' before 'void' 28 | public void out(){ | ^~~~~ | : a.cc:31:2: error: expected ';' after class definition 31 | } | ^ | ; a.cc: In member function 'void RealNumber::add(RealNumber)': a.cc:18:9: error: 'BigInteger' was not declared in this scope 18 | BigInteger G=b.gcd(r.b); | ^~~~~~~~~~ a.cc:19:20: error: expected ';' before 'tmpb' 19 | BigInteger tmpb=b.multiply(r.b.divide(G)); | ^~~~ a.cc:20:9: error: 'a' was not declared in this scope 20 | a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); | ^ a.cc:20:24: error: 'class RealNumber' has no member named 'b' 20 | a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); | ^ a.cc:20:33: error: 'G' was not declared in this scope 20 | a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); | ^ a.cc:20:43: error: 'class RealNumber' has no member named 'a' 20 | a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); | ^ a.cc:20:54: error: 'b' was not declared in this scope 20 | a=a.multiply(r.b.divide(G)).add(r.a.multiply(b.divide(G))); | ^ a.cc:21:11: error: 'tmpb' was not declared in this scope 21 | b=tmpb; | ^~~~ a.cc: In member function 'void RealNumber::out()': a.cc:29:9: error: 'System' was not declared in this scope 29 | System.out.println(a+" / " +b); | ^~~~~~ a.cc:29:28: error: 'a' was not declared in this scope 29 | System.out.println(a+" / " +b); | ^ a.cc:29:37: error: 'b' was not declared in this scope 29 | System.out.println(a+" / " +b); | ^ a.cc: At global scope: a.cc:34:11: error: expected ':' before 'static' 34 | public static void main(String []s ){ | ^~~~~~~ | : a.cc:34:29: error: 'String' has not been declared 34 | public static void main(String []s ){ | ^~~~~~ a.cc:34:39: error: expected ',' or '...' before 's' 34 | public static void main(String []s ){ | ^ a.cc:64:2: error: expected ';' after class definition 64 | } | ^ | ; a.cc: In static member function 'static void Main::main(int*)': a.cc:35:9: error: 'Scanner' was not declared in this scope 35 | Scanner sc = new Scanner(System.in); | ^~~~~~~ a.cc:36:30: error: initializer fails to determine size of 'table' 36 | RealNumber table[] = new RealNumber[10001]; | ^~~~~~~~~~~~~~~~~~~~~ a.cc:36:30: error: array must be initialized with a brace-enclosed initializer a.cc:37:43: error: expected type-specifier before 'BigInteger' 37 | RealNumber R = new RealNumber(new BigInteger("1"),new BigInteger("1")); | ^~~~~~~~~~ a.cc:37:63: error: expected type-specifier before 'BigInteger' 37 | RealNumber R = new RealNumber(new BigInteger("1"),new BigInteger("1")); | ^~~~~~~~~~ a.cc:37:78: error: new initializer expression list treated as compound expression [-fpermissive] 37 | RealNumber R = new RealNumber(new BigInteger("1"),new BigInteger("1")); | ^ a.cc:40:35: error: 'Integer' was not declared in this scope 40 | R.add( new RealNumber(Integer.toString(1),Integer.toString(i)) ); | ^~~~~~~ a.cc:40:74: error: new initializer expression list treated as compound expression [-fpermissive] 40 | R.add( new RealNumber(Integer.toString(1),Integer.toString(i)) ); | ^ a.cc:45:13: error: 'BigDecimal' was not declared in this scope 45 | BigDecimal ans=new BigDecimal(0); | ^~~~~~~~~~ a.cc:46:17: error: 'sc' was not declared in this scope 46 | n = sc.nextInt(); | ^~ a.cc:51:24: error: expected ';' before 'bdn' 51 | BigDecimal bdn = new BigDecimal(n); | ^~~ a.cc:53:17: error: 'ans' was not declared in this scope 53 | ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); | ^~~ a.cc:53:45: error: 'bdn' was not declared in this scope 53 | ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); | ^~~ a.cc:55:17: error: 'ans' was not declared in this scope 55 | ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); | ^~~ a.cc:55:45: error: 'bdn' was not declared in this scope 55 | ans = BigDecimal.ONE.divide(bdn,r+10,BigDecimal.ROUND_DOWN); | ^~~ a.cc:56:28: error: expected ';' before 'bdtmp' 56 | BigDecimal bdtmp = new BigDecimal(table[n-1].a); | ^~~~~ a.cc:57:17: error: 'bdtmp' was not declared in this scope 57 | bdtmp = bdtmp.divide( new BigDecimal(table[n-1].b), r+10, BigDecimal.ROUND_DOWN); | ^~~~~ a.cc:57:43: error: expected type-specifier before 'BigDecimal' 57 | bdtmp = bdtmp.divide( new BigDecimal(table[n-1].b), r+10, BigDecimal.ROUND_DOWN); | ^~~~~~~~~~ a.cc:61:13: error: 'System' was not declared in this scope 61 | System.out.println( ans.divide(BigDecimal.ONE,r,BigDecimal.ROUND_DOWN) ); | ^~~~~~ a.cc:61:33: error: 'ans' was not declared in this scope 61 | System.out.println( ans.divide(BigDecimal.ONE,r,BigDecimal.ROUND_DOWN) ); | ^~~
s853678601
p00427
C++
import java.math.BigDecimal; import java.math.BigInteger; import java.util.*; class Main { class AOJ0504{ void run(){ Scanner sc=new Scanner(System.in); BigDecimal answer = new BigDecimal(1); BigDecimal one = new BigDecimal(1); int n = sc.nextInt(); int k = sc.nextInt(); int m = sc.nextInt(); int r = sc.nextInt(); if(n == 0) return ; if(m==1){ for(int i = 1 ; i <= n-1 ; i++){ //System.out.printf("%d\n",i); answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP)); } } answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP); String s = answer.toPlainString(); for(int i = 0 ; i < r+2 ; i++) System.out.printf("%c",s.charAt(i)); System.out.printf("\n"); } } public static void main(String[] args) { new Main().new AOJ0504().run(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.math.BigDecimal; | ^~~~~~ a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:2:1: error: 'import' does not name a type 2 | import java.math.BigInteger; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:3:1: error: 'import' does not name a type 3 | import java.util.*; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:27:10: error: expected ';' after class definition 27 | } | ^ | ; a.cc:28:15: error: expected ':' before 'static' 28 | public static void main(String[] args) { | ^~~~~~~ | : a.cc:28:33: error: 'String' has not been declared 28 | public static void main(String[] args) { | ^~~~~~ a.cc:28:42: error: expected ',' or '...' before 'args' 28 | public static void main(String[] args) { | ^~~~ a.cc:31:2: error: expected ';' after class definition 31 | } | ^ | ; a.cc: In member function 'void Main::AOJ0504::run()': a.cc:7:25: error: 'Scanner' was not declared in this scope 7 | Scanner sc=new Scanner(System.in); | ^~~~~~~ a.cc:8:25: error: 'BigDecimal' was not declared in this scope 8 | BigDecimal answer = new BigDecimal(1); | ^~~~~~~~~~ a.cc:9:36: error: expected ';' before 'one' 9 | BigDecimal one = new BigDecimal(1); | ^~~ a.cc:10:33: error: 'sc' was not declared in this scope 10 | int n = sc.nextInt(); | ^~ a.cc:18:41: error: 'answer' was not declared in this scope 18 | answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP)); | ^~~~~~ a.cc:18:61: error: 'one' was not declared in this scope 18 | answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP)); | ^~~ a.cc:18:76: error: expected type-specifier before 'BigDecimal' 18 | answer = answer.add(one.divide(new BigDecimal(i),10000,BigDecimal.ROUND_HALF_UP)); | ^~~~~~~~~~ a.cc:21:25: error: 'answer' was not declared in this scope 21 | answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP); | ^~~~~~ a.cc:21:52: error: expected type-specifier before 'BigDecimal' 21 | answer = answer.divide(new BigDecimal(n),10000,BigDecimal.ROUND_HALF_UP); | ^~~~~~~~~~ a.cc:22:25: error: 'String' was not declared in this scope 22 | String s = answer.toPlainString(); | ^~~~~~ a.cc:24:33: error: 'System' was not declared in this scope 24 | System.out.printf("%c",s.charAt(i)); | ^~~~~~ a.cc:24:56: error: 's' was not declared in this scope 24 | System.out.printf("%c",s.charAt(i)); | ^ a.cc:25:25: error: 'System' was not declared in this scope 25 | System.out.printf("\n"); | ^~~~~~ a.cc: In static member function 'static void Main::main(int*)': a.cc:29:27: error: expected ';' before '.' token 29 | new Main().new AOJ0504().run(); | ^
s621608525
p00427
C++
#include <istream> using namespace std; int main(){ int n,m,r; char *s="%.0lf\n"; while(cin>>n>>r>>m>>r,n){ double k=1; if(m) for(m=n;--m;)k+=(double)1/m; s[2]='0'+r; printf(s,k/n); } }
a.cc: In function 'int main()': a.cc:5:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings] 5 | char *s="%.0lf\n"; | ^~~~~~~~~ a.cc:6:15: error: 'cin' was not declared in this scope 6 | while(cin>>n>>r>>m>>r,n){ | ^~~ a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 1 | #include <istream> +++ |+#include <iostream> 2 | using namespace std;
s397109221
p00427
C++
#include <iostream> using namespace std; int main(){ int n,m,r,t; char s[10]; strcpy(s,"%.0lf\n"); while(cin>>n>>t>>m>>r,n){ double k=1; if(m) for(m=n;--m;)k+=(double)1/m; s[2]='0'+r; printf(s,k/n); } }
a.cc: In function 'int main()': a.cc:6:9: error: 'strcpy' was not declared in this scope 6 | strcpy(s,"%.0lf\n"); | ^~~~~~ a.cc:2:1: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std;
s346838418
p00427
C++
#include <iostream> #include <vector> using namespace std; const int MAX_R = 10000; const int MAX_N = 10000; const int MAX_K = 100; int n, k, m, r; int rest[MAX_N+1]; vector<int> num; vector<int> use; int trial; int success; bool is_success() { bool ret = true; for(int i=1; i<=n; i++) { if(rest[i] != 0) { ret = false; break; } } return ret; } int get() { for(int i=1; i<=n; i++) { if(rest[i] != 0) { return i; } } return -1; } void solve() { for(int i=0; i<num.size(); i++) { if(use[i]) continue; // printf("num=%d\n", num[i]); if(rest[num[i]] > 0) { // printf("proceed\n"); rest[num[i]]--; use[i] = 1; solve(); rest[num[i]]++; use[i] = 0; } else if(is_success()) { // printf("success\n"); success++; trial++; } else if(m > 0) { // printf("retry\n"); int j = get(); rest[j]--; use[i] = 1; m--; solve(); rest[j]++; use[i] = 0; m++; } else { // printf("false\n"); trial++; } } } int main() { while( 1 ) { cin >> n >> k >> m >> r; if(!(n | k | m | r)) break; memset(rest, 0, sizeof(int)*MAX_K); use = vector<int>(n * k); memset(&use[0], 0, sizeof(int)*n*k); num.clear(); for(int i=0; i<n; i++) { for(int j=0; j<k; j++) { num.push_back(i+1); } rest[i+1] = k; } rest[1]--; trial = 0; success = 0; solve(); // printf("trial=%d, success=%d\n", trial, success); printf("%f\n", (double)success / (double)trial); } }
a.cc: In function 'int main()': a.cc:73:17: error: 'memset' was not declared in this scope 73 | memset(rest, 0, sizeof(int)*MAX_K); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <vector> +++ |+#include <cstring> 3 | using namespace std;
s439228014
p00427
C++
#inlucde <cstdio> #include <cstdlib> #include <iostream> #include <iomanip> #include <cstring> using namespace std; #define rep(i,n) for(int i=0; i<n; i++) #define repa(i,s,e) for(int i=s; i<=e; i++) #define repd(i,s,e) for(int i=s; i>=e; i--) const int R_MAX = 100011; int n, k, m, r; int ans[R_MAX]; void add(int d) { ans[0] += 1 / d; int res = 1 % d; repa(i,1,r+10) { res *= 10; ans[i] += res / d; if(res % d == 0) break; res = res % d; } repd(i,r+10,0) { if(ans[i] >= 10) { int u = ans[i] / 10; ans[i] = ans[i] % 10; ans[i-1] += u; } } } void div(int d) { int res = 0; rep(i,r+10) { res += ans[i]; ans[i] = res / d; res = res % d; res *= 10; } } int main() { while(cin>>n>>k>>m>>r, n|k|m|r) { memset(ans, 0, sizeof(int) * R_MAX); if(m == 0) { add(n); } else { repa(i,1,n-1) { add(i); } div(n); add(n); } printf("%d.", ans[0]); repa(i,1,r) printf("%d", ans[i]); printf("\n"); } }
a.cc:1:2: error: invalid preprocessing directive #inlucde; did you mean #include? 1 | #inlucde <cstdio> | ^~~~~~~ | include
s274877161
p00428
Java
import java.util.Arrays; import java.util.Scanner; public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); for (;;) { int m = sc.nextInt(), n = sc.nextInt(); if ((m | n) == 0) { break; } int[] r = new int[n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) r[j] += sc.nextInt(); } int[] t = r.clone(); Arrays.sort(r); for (int i = n - 1; i >= 0; i--) { for (int j = 0; j < n; j++) { if (r[i] == t[j]) { System.out.print((j + 1) + (i > 0 ? " " : "\n")); t[j]=-1; } } } } } }
Main.java:4: error: class Main2 is public, should be declared in a file named Main2.java public class Main2 { ^ 1 error
s639006547
p00428
C
#include<stdio.h> int main() { int n,m,i,j,max; int k[1000][100]; int sum[100]; while(scanf("%d%d",&n,&m),n+m){ for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d",&k[i][j]); } for(i=0;i<100;i++) sum[i]=0; for(j=0;j<m;j++){ for(i=0;i<n;i++){ sum[j]+=k[i][j]; } } for(i=0;i<m;i++){ for(j=n;j>=0;j++){ if(sum[i]==j) printf("%d",i); } } printf("\n"); } return 0; }
main.c: In function 'main': main.c:32:1: error: expected declaration or statement at end of input 32 | } | ^
s118583293
p00428
C
#include <stdio.h> int a,b,c[1000][1000],d[1000][2],e,i,j; int main(){ while(1){ scanf("%d %d",&a,&b); if(a==0&&b==0){ return 0; } for(i=0;i<a;i++){ for(j=0;j<b;j++){ scanf("%d",&c[i][j]); } } for(j=0;j<b;j++){ d[j][0]=0; d[j][1]=j; for(i=0;i<a;i++){ d[j][0]+=c[i][j]; } } for(j=0;j<b;j++){ for(i=0;i<b-1;i++){ if(d[i][0]>d[i+1][0]){ e=d[i][0]; d[i][0]=d[i+1][0]; d[i+1][0]=e; e=d[i][1]; d[i][1]=d[i+1][1]; d[i+1][1]=e; } if(d[i][0]==d[i+1][0]){ if(d[i][1]<d[i+1][1]){ e=d[i][1]; d[i][1]=d[i+1][1]; d[i+1][1]=e; } } } } for(i=b-1;i>0;i--){ printf("%d ",d[i][1]+1); } printf("%d\n"d[0][1]+1); } }
main.c: In function 'main': main.c:47:30: error: expected ')' before 'd' 47 | printf("%d\n"d[0][1]+1); | ~ ^ | )
s954603406
p00428
C
#include <stdio.h> int a,b,c[1000][1000],d[1000][2],e,i,j; int main(){ while(1){ scanf("%d %d",&a,&b); if(a==0&&b==0){ return 0; } for(i=0;i<a;i++){ for(j=0;j<b;j++){ scanf("%d",&c[i][j]); } } for(j=0;j<b;j++){ d[j][0]=0; d[j][1]=j; for(i=0;i<a;i++){ d[j][0]+=c[i][j]; } } for(j=0;j<b;j++){ for(i=0;i<b-1;i++){ if(d[i][0]>d[i+1][0]){ e=d[i][0]; d[i][0]=d[i+1][0]; d[i+1][0]=e; e=d[i][1]; d[i][1]=d[i+1][1]; d[i+1][1]=e; } if(d[i][0]==d[i+1][0]){ if(d[i][1]<d[i+1][1]){ e=d[i][1]; d[i][1]=d[i+1][1]; d[i+1][1]=e; } } } } for(i=b-1;i>0;i--){ printf("%d ",d[i][1]+1); } printf("%d\n"d[0][1]+1); } }
main.c: In function 'main': main.c:47:30: error: expected ')' before 'd' 47 | printf("%d\n"d[0][1]+1); | ~ ^ | )
s518597318
p00428
C
if(n==0&&m==0)break; for(i=0;i<100;i++){ b[i]=0; a[i]=i+1; }
main.c:1:5: error: expected identifier or '(' before 'if' 1 | if(n==0&&m==0)break; | ^~ main.c:2:5: error: expected identifier or '(' before 'for' 2 | for(i=0;i<100;i++){ | ^~~ main.c:2:14: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 2 | for(i=0;i<100;i++){ | ^ main.c:2:20: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token 2 | for(i=0;i<100;i++){ | ^~
s384147554
p00428
C
#include<stdio.h> struct ABC{ int p,r,no; }; int main() { for(;;){ int n,m,l,x,a; ABC d[100],s; for(n=0;n<100;n++){ d[n].r=n+1; d[n].no=n; d[n].p=0; } scanf("%d%d",&n,&l); if(n==0&&l==0) break; for(m=0;m<n;m++){ for(x=0;x<l;x++){ scanf("%d",&a); d[x].p+=a; } } for(m=0;m<l;m++){ for(x=m+1;x<l;x++){ if(d[m].p<d[x].p){ s.p=d[m].p; d[m].p=d[x].p; d[x].p=s.p; s.no=d[m].no; d[m].no=d[x].no; d[x].no=s.no; } } } for(m=0;m<l;m++){ for(x=m+1;x<l;x++){ if(d[m].no>d[x].no){ s=d[m]; d[m]=d[x]; d[x]=s; } } } for(m=0;m<l;m++){ printf("%d",d[m].r); if(m!=l-1) printf(" "); } printf("\n"); } return 0; }
main.c: In function 'main': main.c:9:17: error: unknown type name 'ABC'; use 'struct' keyword to refer to the type 9 | ABC d[100],s; | ^~~ | struct main.c:11:29: error: request for member 'r' in something not a structure or union 11 | d[n].r=n+1; | ^ main.c:12:29: error: request for member 'no' in something not a structure or union 12 | d[n].no=n; | ^ main.c:13:29: error: request for member 'p' in something not a structure or union 13 | d[n].p=0; | ^ main.c:21:37: error: request for member 'p' in something not a structure or union 21 | d[x].p+=a; | ^ main.c:26:40: error: request for member 'p' in something not a structure or union 26 | if(d[m].p<d[x].p){ | ^ main.c:26:47: error: request for member 'p' in something not a structure or union 26 | if(d[m].p<d[x].p){ | ^ main.c:27:42: error: request for member 'p' in something not a structure or union 27 | s.p=d[m].p; | ^ main.c:27:49: error: request for member 'p' in something not a structure or union 27 | s.p=d[m].p; | ^ main.c:28:45: error: request for member 'p' in something not a structure or union 28 | d[m].p=d[x].p; | ^ main.c:28:52: error: request for member 'p' in something not a structure or union 28 | d[m].p=d[x].p; | ^ main.c:29:45: error: request for member 'p' in something not a structure or union 29 | d[x].p=s.p; | ^ main.c:29:49: error: request for member 'p' in something not a structure or union 29 | d[x].p=s.p; | ^ main.c:30:42: error: request for member 'no' in something not a structure or union 30 | s.no=d[m].no; | ^ main.c:30:50: error: request for member 'no' in something not a structure or union 30 | s.no=d[m].no; | ^ main.c:31:45: error: request for member 'no' in something not a structure or union 31 | d[m].no=d[x].no; | ^ main.c:31:53: error: request for member 'no' in something not a structure or union 31 | d[m].no=d[x].no; | ^ main.c:32:45: error: request for member 'no' in something not a structure or union 32 | d[x].no=s.no; | ^ main.c:32:50: error: request for member 'no' in something not a structure or union 32 | d[x].no=s.no; | ^ main.c:38:40: error: request for member 'no' in something not a structure or union 38 | if(d[m].no>d[x].no){ | ^ main.c:38:48: error: request for member 'no' in something not a structure or union 38 | if(d[m].no>d[x].no){ | ^ main.c:46:41: error: request for member 'r' in something not a structure or union 46 | printf("%d",d[m].r); | ^
s073939698
p00428
C
#include <stdio.h> #include <stdlib.h> typedef struct { int no; int num; } place_t; int comp(const void* x,const void* y) { place_t* a=(place_t*)x; place_t* b=(place_t*)y; if(a.num>b.num)return 1; if(a.num<b.num)return -1; if(a.no>b.no)return 1; if(a.no<b.no)return -1; return 0; } int main(void) { place_t place[100]; int i,j,n,m; int one; while(1) { scanf("%d %d",&n,&m); if(n==0 && m==0)break; for(i=0;i<100;i++) { place[i].no=i; place[i].num=0; for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",&one); if(one)place[j].num++; } } qsort(place,m,sizeof(place_t),comp); for(i=0;i<m-1;i++) { printf("%d ",place[i].no+1); } printf("%d\n".place[m-1].no+1); } return 0; }
main.c: In function 'comp': main.c:12:13: error: 'a' is a pointer; did you mean to use '->'? 12 | if(a.num>b.num)return 1; | ^ | -> main.c:12:19: error: 'b' is a pointer; did you mean to use '->'? 12 | if(a.num>b.num)return 1; | ^ | -> main.c:13:13: error: 'a' is a pointer; did you mean to use '->'? 13 | if(a.num<b.num)return -1; | ^ | -> main.c:13:19: error: 'b' is a pointer; did you mean to use '->'? 13 | if(a.num<b.num)return -1; | ^ | -> main.c:14:13: error: 'a' is a pointer; did you mean to use '->'? 14 | if(a.no>b.no)return 1; | ^ | -> main.c:14:18: error: 'b' is a pointer; did you mean to use '->'? 14 | if(a.no>b.no)return 1; | ^ | -> main.c:15:13: error: 'a' is a pointer; did you mean to use '->'? 15 | if(a.no<b.no)return -1; | ^ | -> main.c:15:18: error: 'b' is a pointer; did you mean to use '->'? 15 | if(a.no<b.no)return -1; | ^ | -> main.c: In function 'main': main.c:39:30: error: request for member 'place' in something not a structure or union 39 | printf("%d\n".place[m-1].no+1); | ^ main.c:42:1: error: expected declaration or statement at end of input 42 | } | ^
s881808320
p00428
C
#include <stdio.h> #include <stdlib.h> typedef struct { int no; int num; } place_t; int comp(const void* x,const void* y) { place_t* a=(place_t*)x; place_t* b=(place_t*)y; if(a->num>b->num)return 1; if(a->num<b->num)return -1; if(a->no>b->no)return 1; if(a->no<b->no)return -1; return 0; } int main(void) { place_t place[100]; int i,j,n,m; int one; while(1) { scanf("%d %d",&n,&m); if(n==0 && m==0)break; for(i=0;i<100;i++) { place[i].no=i; place[i].num=0; for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",&one); if(one)place[j].num++; } } qsort(place,m,sizeof(place_t),comp); for(i=0;i<m-1;i++) { printf("%d ",place[i].no+1); } printf("%d\n",place[m-1].no+1); } return 0; }
main.c: In function 'main': main.c:42:1: error: expected declaration or statement at end of input 42 | } | ^
s364802080
p00428
C
#include<stdio.h> int main(void){ int p[100],rank[100]; int n,m; int i,j; int tmp; while(1){ scanf("%d %d ",&n,&m); if(!n && !m)break; for(i=0;i<m;i++){ p[i] = 0; rank[i] = i; } for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d ",&tmp); p[j] += tmp; } } for(i=0;i<m-1;i++){ for(j=i+1;j<m;j++){ if(p[rank[i]]<p[rank[j]]){ tmp = rank[i]; rank[i] = rank[j]; rank[j] = tmp; } if(p[rank[i]]==p[rank[j]]){ if(rank[i]>rank[j]){ tmp = rank[i]; rank[i] = rank[j]; rank[j] = tmp; } } } } for(i=0;i<m;i++){ printf("%d",rank[i]+1); if(i!=m-1)putchar(' '); } putchar('n'); } return 0; }
main.c:1:21: warning: extra tokens at end of #include directive 1 | #include<stdio.h> int main(void){ int p[100],rank[100]; int n,m; int i,j; int tmp; while(1){ scanf("%d %d ",&n,&m); if(!n && !m)break; for(i=0;i<m;i++){ p[i] = 0; rank[i] = i; } for(i=0;i<n;i++){ for(j=0;j<m;j++){ scanf("%d ",&tmp); p[j] += tmp; } } for(i=0;i<m-1;i++){ for(j=i+1;j<m;j++){ if(p[rank[i]]<p[rank[j]]){ tmp = rank[i]; rank[i] = rank[j]; rank[j] = tmp; } if(p[rank[i]]==p[rank[j]]){ if(rank[i]>rank[j]){ tmp = rank[i]; rank[i] = rank[j]; rank[j] = tmp; } } } } for(i=0;i<m;i++){ printf("%d",rank[i]+1); if(i!=m-1)putchar(' '); } putchar('n'); } return 0; } | ^~~ /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start': (.text+0x17): undefined reference to `main' collect2: error: ld returned 1 exit status
s196896614
p00428
C
#include<stdio.h> #include<string.h> int main(){ while(1){ int n, m, results[100], i ,j; memset(rusults, 0, sizeof(results)); scanf("%d%d", &n, &m); if(n == 0 && m == 0)return 0; for(i = 0;i < n;i++){ for(j = 0;j < m;j++){ int k; scanf("%d", &k); results[j] += k; } } for(i = 0;i < 100;i++){ for(j = 0;j < m;j++){ if(results[j] == i){ printf("%d ",j + 1); } } } puts(""); } }
main.c: In function 'main': main.c:6:12: error: 'rusults' undeclared (first use in this function); did you mean 'results'? 6 | memset(rusults, 0, sizeof(results)); | ^~~~~~~ | results main.c:6:12: note: each undeclared identifier is reported only once for each function it appears in
s555851522
p00428
C
#include <stdio.h> int main(void){ int i,j,n,m,result[100],h,rank[100]; for(i=0; i<100; i++){ result[i]=0; rank[i]=0; } scanf(“%d%d”,&n,&m); for(i=0; i<n; i++){ for(j=0; j<m; j++){ scanf(“%d”,&h); result[j]+=h; } } for(i=0; i<m; i++){ j=0; for(j=0; j<m; j++){ if(result[i]<result[j]){ j++; } } while(rank[j]!=0){ j++; } rank[j]=(i+1); } for(i=0; i<m; i++){ if(i==(m-1)){ printf(“%d ”,rank[i]); }else{ printf(“%d\n”,rank[i]); } } return 0; }
main.c: In function 'main': main.c:8:15: error: stray '\342' in program 8 | scanf(<U+201C>%d%d<U+201D>,&n,&m); | ^~~~~~~~ main.c:8:16: error: expected expression before '%' token 8 | scanf(“%d%d”,&n,&m); | ^ main.c:8:20: error: stray '\342' in program 8 | scanf(<U+201C>%d%d<U+201D>,&n,&m); | ^~~~~~~~ main.c:11:31: error: stray '\342' in program 11 | scanf(<U+201C>%d<U+201D>,&h); | ^~~~~~~~ main.c:11:32: error: expected expression before '%' token 11 | scanf(“%d”,&h); | ^ main.c:11:34: error: stray '\342' in program 11 | scanf(<U+201C>%d<U+201D>,&h); | ^~~~~~~~ main.c:29:32: error: stray '\342' in program 29 | printf(<U+201C>%d <U+201D>,rank[i]); | ^~~~~~~~ main.c:29:33: error: expected expression before '%' token 29 | printf(“%d ”,rank[i]); | ^ main.c:29:36: error: stray '\342' in program 29 | printf(<U+201C>%d <U+201D>,rank[i]); | ^~~~~~~~ main.c:31:32: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,rank[i]); | ^~~~~~~~ main.c:31:33: error: expected expression before '%' token 31 | printf(“%d\n”,rank[i]); | ^ main.c:31:35: error: stray '\' in program 31 | printf(“%d\n”,rank[i]); | ^ main.c:31:37: error: stray '\342' in program 31 | printf(<U+201C>%d\n<U+201D>,rank[i]); | ^~~~~~~~
s893351614
p00428
C
#include <stdio.h> int main(void){ int i,j,n,m,result[100],h,rank[100]; for(i=0; i<100; i++){ result[i]=0; rank[i]=0; } scanf(“%d%d”,&n,&m); for(i=0; i<n; i++){ for(j=0; j<m; j++){ scanf(“%d”,&h); result[j]+=h; } } for(i=0; i<m; i++){ j=0; for(j=0; j<m; j++){ if(result[i]<result[j]){ } while(rank[j]!=0){ j++; } rank[j]=(i+1); } for(i=0; i<m; i++){ if(i==(m-1)){ printf(“%d ”,rank[i]); }else{ printf(“%d\n”,rank[i]); } } return 0; }
main.c: In function 'main': main.c:8:15: error: stray '\342' in program 8 | scanf(<U+201C>%d%d<U+201D>,&n,&m); | ^~~~~~~~ main.c:8:16: error: expected expression before '%' token 8 | scanf(“%d%d”,&n,&m); | ^ main.c:8:20: error: stray '\342' in program 8 | scanf(<U+201C>%d%d<U+201D>,&n,&m); | ^~~~~~~~ main.c:11:31: error: stray '\342' in program 11 | scanf(<U+201C>%d<U+201D>,&h); | ^~~~~~~~ main.c:11:32: error: expected expression before '%' token 11 | scanf(“%d”,&h); | ^ main.c:11:34: error: stray '\342' in program 11 | scanf(<U+201C>%d<U+201D>,&h); | ^~~~~~~~ main.c:27:32: error: stray '\342' in program 27 | printf(<U+201C>%d <U+201D>,rank[i]); | ^~~~~~~~ main.c:27:33: error: expected expression before '%' token 27 | printf(“%d ”,rank[i]); | ^ main.c:27:36: error: stray '\342' in program 27 | printf(<U+201C>%d <U+201D>,rank[i]); | ^~~~~~~~ main.c:29:32: error: stray '\342' in program 29 | printf(<U+201C>%d\n<U+201D>,rank[i]); | ^~~~~~~~ main.c:29:33: error: expected expression before '%' token 29 | printf(“%d\n”,rank[i]); | ^ main.c:29:35: error: stray '\' in program 29 | printf(“%d\n”,rank[i]); | ^ main.c:29:37: error: stray '\342' in program 29 | printf(<U+201C>%d\n<U+201D>,rank[i]); | ^~~~~~~~ main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^
s237801078
p00428
C
#include <stdio.h> int main(void){ int i,j,n,m,result[100],h,rank[100]; for(i=0; i<100; i++){ result[i]=0; rank[i]=0; } scanf("%d%d",&n,&m); for(i=0; i<n; i++){ for(j=0; j<m; j++){ scanf("%d",&h); result[j]+=h; } } for(i=0; i<m; i++){ j=0; for(j=0; j<m; j++){ if(result[i]<result[j]){ } while(rank[j]!=0){ j++; } rank[j]=(i+1); } for(i=0; i<m; i++){ if(i==(m-1)){ printf("%d ",rank[i]); }else{ printf("%d\n",rank[i]); } } return 0; }
main.c: In function 'main': main.c:33:1: error: expected declaration or statement at end of input 33 | } | ^
s315585166
p00428
C
#include <stdio.h> int main(void){ int i,j,n,m,result[100],h,rank[100]; scanf("%d%d",&n,&m); while(n!=0 || m!=0){ for(i=0; i<100; i++){ result[i]=0; rank[i]=0; } for(i=0; i<n; i++){ for(j=0; j<m; j++){ scanf("%d",&h); result[j]+=h; } } for(i=0; i<m; i++){ j=0; for(j=0; j<m; j++){ if(result[i]<result[j]){ } while(rank[j]!=0){ j++; } rank[j]=(i+1); } for(i=0; i<m; i++){ if(i==(m-1)){ printf("%d ",rank[i]); }else{ printf("%d\n",rank[i]); } } scanf("%d%d",&n,&m); } return 0; }
main.c: In function 'main': main.c:36:1: error: expected declaration or statement at end of input 36 | } | ^
s317844804
p00428
C++
#include<iostream> #include<algorithm> #include<vector> using namespace std; int main() { while (1) { int n, m; cin >> n >> m; if (n == 0 && M == 0)break; int su[1200] = {}, hage[1200] = {}; for (int i = 0; i < n; i++) { for (int s = 0; s < m; s++) { int q; cin >> q; su[s] += q; hage[s] += q; } } sort(su, su + m); for (int i = 0; i < m; i++) { for (int c = m - 1; c != -1; c--) { if (su[c] == hage[i]){ su[c] = 1500; cout << 7 - (c + 1) << " "; break; } } } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:31: error: 'M' was not declared in this scope 13 | if (n == 0 && M == 0)break; | ^
s330829045
p00428
C++
#include <utility> #include <algorithm> #include <iostream> using namespace std; int main(){ int N, M, v; pair<int,int> vote_area[110]; while (cin >> N >> M && N>0) { //ペアの初期化 for (int j = 0; j < M; ++i) { vote_area[j].first = 0; vote_area[j].second = j+1;/* code */ } for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++i) { cin >> v;/* i人目の人が場所jに行きたいかどうか */ if (v==1) { vote_area[j].first += 1; } } } //あるタイミングで整列する reverse(vote_area, vote_area+M); for (int i = 0; i < M; ++i) { cout << vote_area[i].second; } cout << endl; } }
a.cc: In function 'int main()': a.cc:10:30: error: 'i' was not declared in this scope 10 | for (int j = 0; j < M; ++i) | ^
s060376997
p00428
C++
#include <utility> #include <algorithm> #include <iostream> using namespace std; int main(){ int N, M, v; pair<int,int> vote_area[110]; while (cin >> N >> M & M >0) { //ペアの初期化 for (int j = 0; j < M; ++j) { vote_area[j].first = 0; vote_area[j].second = j+1;/* code */ } for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) { cin >> v;/* i人目の人が場所jに行きたいかどうか */ vote_area[j].first += v; // cout << vote_area[j].first; } // cout << endl; } //あるタイミングで整列する sort(vote_area, vote_area+M); reverse(vote_area, vote_area+M); for (int i = 0; i < M; ++i) { cout << vote_area[i].second; } cout << endl; } }
a.cc: In function 'int main()': a.cc:8:24: error: no match for 'operator&' (operand types are 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} and 'bool') 8 | while (cin >> N >> M & M >0) { | ~~~~~~~~~~~~~ ^ ~~~~ | | | | | bool | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} a.cc:8:24: note: candidate: 'operator&(int, int)' (built-in) 8 | while (cin >> N >> M & M >0) { | ~~~~~~~~~~~~~~^~~~~~ a.cc:8:24: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'int' In file included from /usr/include/c++/14/bits/memory_resource.h:38, from /usr/include/c++/14/string:68, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:3: /usr/include/c++/14/cstddef:141:3: note: candidate: 'constexpr std::byte std::operator&(byte, byte)' 141 | operator&(byte __l, byte __r) noexcept | ^~~~~~~~ /usr/include/c++/14/cstddef:141:18: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::byte' 141 | operator&(byte __l, byte __r) noexcept | ~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:84:3: note: candidate: 'constexpr std::_Ios_Fmtflags std::operator&(_Ios_Fmtflags, _Ios_Fmtflags)' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:84:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Fmtflags' 84 | operator&(_Ios_Fmtflags __a, _Ios_Fmtflags __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:134:3: note: candidate: 'constexpr std::_Ios_Openmode std::operator&(_Ios_Openmode, _Ios_Openmode)' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:134:27: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Openmode' 134 | operator&(_Ios_Openmode __a, _Ios_Openmode __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ios_base.h:181:3: note: candidate: 'constexpr std::_Ios_Iostate std::operator&(_Ios_Iostate, _Ios_Iostate)' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ^~~~~~~~ /usr/include/c++/14/bits/ios_base.h:181:26: note: no known conversion for argument 1 from 'std::basic_istream<char>::__istream_type' {aka 'std::basic_istream<char>'} to 'std::_Ios_Iostate' 181 | operator&(_Ios_Iostate __a, _Ios_Iostate __b) _GLIBCXX_NOTHROW | ~~~~~~~~~~~~~^~~
s136903632
p00428
C++
#include <utility> #include <algorithm> #include <iostream> using namespace std; int main(){ int N, M, v; pair<int,int> vote_area[110]; while (cin >> N >> M && M >0) { //ペアの初期化 for (int j = 0; j < M; ++j) { vote_area[j].first = 0; vote_area[j].second = j+1;/* code */ } for (int i = 0; i < N; ++i) { for (int j = 0; j < M; ++j) { cin >> v;/* i人目の人が場所jに行きたいかどうか */ vote_area[j].first -= v; // cout << vote_area[j].first; } // cout << endl; } //あるタイミングで整列する sort(vote_area, vote_area+M); // reverse(vote_area, vote_area+M); for (int i = 0; i < M; ++i) { cout << vote_area[i].second; if (i<M-1) { cout << " " } } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:35:20: error: expected ';' before '}' token 35 | cout << " " | ^ | ; 36 | } | ~
s661250333
p00428
C++
#include <iostream> #include <vector> #include <utility> using namespace std; typedef pair<int, int> pii; bool greaterP(pii lhs, pii rhs) { if (lhs.first != rhs.first) { return lhs.first > rhs.first; } else { return lhs.second < rhs.second; } } int main(void) { int n, m; while (cin >> n >> m, n+m) { vector<pii> Q(m); for (int i = 0; i < m; i++) { Q[i].first = 0; Q[i].second = i+1; } int q; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> q; if (q) { Q[j].first++; } } } sort(Q.begin(), Q.end(), greaterP); cout << Q[0].second; for (int i = 1; i < m; i++) { cout << " " << Q[i].second; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:35:9: error: 'sort' was not declared in this scope; did you mean 'short'? 35 | sort(Q.begin(), Q.end(), greaterP); | ^~~~ | short
s709329306
p00428
C++
#include <iostream> #include <vector> #include <map> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n,m; while(cin >> n >> m) { if((n|m) == 0) break; int a[n][m]; for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { cin >> a[i][j]; } } vector< pair<int,int> > q_res; for(int j=0;j<m;j++) { int place_id = j+1; int popular = 0; for(int i=0;i<n;i++) { if(a[i][j]==1) popular++; } q_res.push_back(make_pair(-popular,place_id)); } sort(q_res.begin(),q_res.end()); for(int j=0;j<m;j++) { cout << q_res[j].second << (j+1 == m ? "\n" : " "); } q_res.clear(); } // end while }
a.cc: In function 'int main()': a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'short'? 31 | sort(q_res.begin(),q_res.end()); | ^~~~ | short
s848553865
p00428
C++
#include <iostream> bool comp(const std::pair<int, int>& firstElem, const std::pair<int, int>& secondElem) { return firstElem.second > secondElem.second; } int main() { int n, m; int temp; while(1) { std::cin >> n >> m; if (n == 0 && m == 0) break; std::pair<int, int> sums[100]; for (int j = 0; j < m; j ++) sums[j].first = j + 1; for (int i = 0; i < n; i ++) for (int j = 0; j < m; j ++) { std::cin >> temp; sums[j].second += temp; } std::sort(std::begin(sums), std::end(sums), comp); int k = 0; while (1) { std::cout << sums[k ++].first;; if (k != m) std::cout << " "; else break; } std::cout << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 24 | std::sort(std::begin(sums), std::end(sums), comp); | ^~~~ | qsort
s155675722
p00428
C++
#include <iostream> bool comp(const std::pair<int, int>& firstElem, const std::pair<int, int>& secondElem) { return firstElem.second > secondElem.second; } int main() { int n, m; int temp; while(1) { std::cin >> n >> m; if (n == 0 && m == 0) break; std::pair<int, int> sums[100]; for (int j = 0; j < m; j ++) sums[j].first = j + 1; for (int i = 0; i < n; i ++) for (int j = 0; j < m; j ++) { std::cin >> temp; sums[j].second += temp; } std::sort(std::begin(sums), std::end(sums), comp); int k = 0; while (1) { std::cout << sums[k ++].first;; if (k != m) std::cout << " "; else break; } std::cout << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 24 | std::sort(std::begin(sums), std::end(sums), comp); | ^~~~ | qsort
s914654381
p00428
C++
#include <iostream> bool comp(const std::pair<int, int>& firstElem, const std::pair<int, int>& secondElem) { return firstElem.second > secondElem.second; } int main() { int n, m; int temp; while(1) { std::cin >> n >> m; if (n == 0 && m == 0) break; std::pair<int, int> sums[100]; for (int j = 0; j < m; j ++) sums[j].first = j + 1; for (int i = 0; i < n; i ++) for (int j = 0; j < m; j ++) { std::cin >> temp; sums[j].second += temp; } std::sort(std::begin(sums), std::end(sums), comp); int k = 0; while (1) { std::cout << sums[k ++].first;; if (k != m) std::cout << " "; else break; } std::cout << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 24 | std::sort(std::begin(sums), std::end(sums), comp); | ^~~~ | qsort
s897367002
p00428
C++
#include <iostream> bool comp(const std::pair<int, int>& firstElem, const std::pair<int, int>& secondElem) { return firstElem.second > secondElem.second; } int main() { int n, m; int temp; while(1) { std::cin >> n >> m; if (n == 0 && m == 0) break; std::pair<int, int> sums[100]; for (int j = 0; j < m; j ++) sums[j].first = j + 1; for (int i = 0; i < n; i ++) for (int j = 0; j < m; j ++) { std::cin >> temp; sums[j].second += temp; } std::sort(std::begin(sums), std::end(sums), comp); int k = 0; while (1) { std::cout << sums[k ++].first;; if (k != m) std::cout << " "; else break; } std::cout << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 24 | std::sort(std::begin(sums), std::end(sums), comp); | ^~~~ | qsort
s460291880
p00428
C++
#include <iostream> bool comp(const std::pair<int, int>& firstElem, const std::pair<int, int>& secondElem) { return firstElem.second > secondElem.second; } int main() { int n, m; int temp; while(1) { std::cin >> n >> m; if (n == 0 && m == 0) break; std::pair<int, int> sums[100]; for (int j = 0; j < m; j ++) sums[j].first = j + 1; for (int i = 0; i < n; i ++) for (int j = 0; j < m; j ++) { std::cin >> temp; sums[j].second += temp; } std::sort(std::begin(sums), std::end(sums), comp); int k = 0; while (1) { std::cout << sums[k ++].first;; if (k != m) std::cout << " "; else break; } std::cout << std::endl; } return 0; }
a.cc: In function 'int main()': a.cc:24:10: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 24 | std::sort(std::begin(sums), std::end(sums), comp); | ^~~~ | qsort
s825118919
p00428
C++
using System; using System.Linq; namespace aizu { public class OnlineJudge { static void Main() { int[] input; while(((input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray())[0] | input[1]) != 0) { var data = (from p in Enumerable.Range(1, input[0]) let d = Console.ReadLine().Split().Select(b => b == "1").ToArray() select (Enumerable.Range(1, input[1]).Select(q => new { k = q, v = d[q - 1] })).ToDictionary(q => q.k, q => q.v)).ToArray(); Console.WriteLine(string.Join(" ", Enumerable.Range(1, input[1]).OrderByDescending(p => data.Count(q => q[p] == true)).ThenBy(p => p).Select(q => q.ToString()).ToArray())); } } } }
a.cc:1:7: error: expected nested-name-specifier before 'System' 1 | using System; | ^~~~~~ a.cc:2:7: error: expected nested-name-specifier before 'System' 2 | using System.Linq; | ^~~~~~ a.cc:6:5: error: expected unqualified-id before 'public' 6 | public class OnlineJudge | ^~~~~~
s952810761
p00428
C++
#include<bits/stdc++.h> using namespace std; int main(){ int n,m; int check; while(cin>>n>>m,n+m!=0){ int num[100]={0}; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>check; if(check==1) num[j]++; } } for(int j=n;j>=0;j--){ for(int i=0;i<m;i++){ if(num[i]==j) cout<<i+1<<" "; } } cout<<endl<endl; } return 0; }
a.cc: In function 'int main()': a.cc:22:11: error: parse error in template argument list 22 | cout<<endl<endl; | ^~~~~~~~~ a.cc:22:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '<unresolved overloaded function type>') 22 | cout<<endl<endl; | ~~~~^~~~~~~~~~~ | | | | | <unresolved overloaded function type> | std::ostream {aka std::basic_ostream<char>} In file included from /usr/include/c++/14/istream:41, from /usr/include/c++/14/sstream:40, from /usr/include/c++/14/complex:45, from /usr/include/c++/14/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:243:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'long double' 243 | operator<<(long double __f) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:301:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(const void*) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 301 | operator<<(const void* __p) | ^~~~~~~~ /usr/include/c++/14/ostream:301:30: note: no known conversion for argument 1 from '<unresolved overloaded function type>' to 'const void*' 301 | operator<<(const void* __p) | ~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:306:7: note: candidate: 's
s020171853
p00428
C++
#include <iostream> #include <vector> #include <utility> bool compare(std::pair<int,int> x, std::pair<int,int> y){ return (x.first != y.first) ? x.first > y.first : x.second < y.second; } int n = 0, m = 0; int main(void){ int i = 0; int j = 0; std::vector< std::pair<int,int> > votes; int v = 0; while(std::cin >> n >> m){ if(n==0 && m ==0) break; votes.resize(m); votes.clear(); for(i=0; i<m; ++i){ votes[i].first = 0; votes[i].second = i+1; } for(i=0; i<n; ++i){ for(j=0; j<m; ++j){ std::cin >> v; if(v == 1){ votes[j].first += 1; } } } std::sort(votes.begin(), votes.begin() + m, compare); for(i=0; i<m; ++i){ std::cout << (i==0 ? "" : " ") << votes[i].second; } std::cout << std::endl; } }
a.cc: In function 'int main()': a.cc:36:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 36 | std::sort(votes.begin(), votes.begin() + m, compare); | ^~~~ | qsort
s907456169
p00428
C++
#include <iostream> #include <vector> #include <utility> bool compare(std::pair<int,int> x, std::pair<int,int> y){ return (x.first != y.first) ? x.first > y.first : x.second < y.second; } int n = 0, m = 0; int main(void){ int i = 0; int j = 0; std::vector< std::pair<int,int> > votes; int v = 0; while(std::cin >> n >> m){ if(n==0 && m ==0) break; votes.resize(m); votes.clear(); for(i=0; i<m; ++i){ votes[i].first = 0; votes[i].second = i+1; } for(i=0; i<n; ++i){ for(j=0; j<m; ++j){ std::cin >> v; if(v == 1){ votes[j].first += 1; } } } std::sort(votes.begin(), votes.begin() + m, compare); for(i=0; i<m; ++i){ std::cout << (i==0 ? "" : " ") << votes[i].second; } std::cout << std::endl; } }
a.cc: In function 'int main()': a.cc:36:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 36 | std::sort(votes.begin(), votes.begin() + m, compare); | ^~~~ | qsort
s618661553
p00428
C++
#include <iostream> #include <vector> #include <utility> bool compare(std::pair<int,int> x, std::pair<int,int> y){ return (x.first != y.first) ? x.first > y.first : x.second < y.second; } int n = 0, m = 0; int main(void){ int i = 0; int j = 0; std::vector< std::pair<int,int> > votes; int v = 0; while(std::cin >> n >> m){ if(n==0 && m ==0) break; votes.resize(m); votes.clear(); for(i=0; i<m; ++i){ votes[i].first = 0; votes[i].second = i+1; } for(i=0; i<n; ++i){ for(j=0; j<m; ++j){ std::cin >> v; if(v == 1){ votes[j].first += 1; } } } std::sort(votes.begin(), votes.begin() + m, compare); for(i=0; i<m; ++i){ std::cout << (i==0 ? "" : " ") << votes[i].second; } std::cout << std::endl; } }
a.cc: In function 'int main()': a.cc:36:14: error: 'sort' is not a member of 'std'; did you mean 'qsort'? 36 | std::sort(votes.begin(), votes.begin() + m, compare); | ^~~~ | qsort
s047014084
p00428
C++
#include<bits\stdc++.h> using namespace std; int main(void){ int n,m,cnt[101],b[101],i,j,temp,a; while(1){ cin>>n>>m; if(n==0&&m==0)break; for(i=1;i<=m;i++) cnt[i]=0,b[i]=i; for(i=0;i<n;i++){ for(j=1;j<=m;j++){ cin>>a; if(a==1) cnt[j]++; } } for(i=1;i<m;i++){ for(j=i+1;j<=m;j++){ if(cnt[i]<cnt[j]){ temp=cnt[i]; cnt[i]=cnt[j]; cnt[j]=temp; temp=b[i]; b[i]=b[j]; b[j]=temp; } } } for(i=1;i<m;i++) cout<<b[i]<<' '; cout<<b[m]<<endl; } return 0; }
a.cc:1:9: fatal error: bits\stdc++.h: No such file or directory 1 | #include<bits\stdc++.h> | ^~~~~~~~~~~~~~~ compilation terminated.
s362454865
p00428
C++
#include<iostream> #include<vector> using namespace std; int n, m; int my_find(int val, int res[]) { for(int i = 0; i < m; i++){ if(res[i] == val){ return i; } } return 0; } int main() { int g, gab; int ank[1000][100]; int max, place; for(;;){ cin >> n; cin >> m; if(n == 0 && m == 0){ break; } vector<int> result_sort(m, 0); vector<int> result(m, 0); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> ank[i][j]; } } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ result[i] += ank[j][i]; } } g = 0; for(int i = 0; i < m; i++){ max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo place = my_find(max, result.begin()); result_sort[i] = place; //êŠ‚ð‘ã“ü result[place] = 0; //Å‘å’l‚Ì‚ ‚Á‚½êŠ‚ð0‚ŏ‘‚«Š·‚¦‚é } for(int i = 0; i < m; i++){ cout << result_sort[i]+1; } } }
a.cc: In function 'int main()': a.cc:48:32: error: 'max_element' was not declared in this scope 48 | max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo | ^~~~~~~~~~~ a.cc:49:58: error: cannot convert 'std::vector<int>::iterator' to 'int*' 49 | place = my_find(max, result.begin()); | ~~~~~~~~~~~~^~ | | | std::vector<int>::iterator a.cc:7:26: note: initializing argument 2 of 'int my_find(int, int*)' 7 | int my_find(int val, int res[]) | ~~~~^~~~~
s338259972
p00428
C++
#include<iostream> #include<vector> using namespace std; int n, m; int my_find(int val, int res[]) { for(int i = 0; i < m; i++){ if(res[i] == val){ return i; } } return 0; } int main() { int ank[1000][100]; int max, place; for(;;){ cin >> n; cin >> m; if(n == 0 && m == 0){ break; } vector<int> result_sort(m, 0); vector<int> result(m, 0); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> ank[i][j]; } } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ result[i] += ank[j][i]; } } for(int i = 0; i < m; i++){ max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo place = my_find(max, result.begin()); result_sort[i] = place; //êŠ‚ð‘ã“ü result[place] = 0; //Å‘å’l‚Ì‚ ‚Á‚½êŠ‚ð0‚ŏ‘‚«Š·‚¦‚é } for(int i = 0; i < m; i++){ cout << result_sort[i]+1; } printf("\n"); } }
a.cc: In function 'int main()': a.cc:45:32: error: 'max_element' was not declared in this scope 45 | max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo | ^~~~~~~~~~~ a.cc:46:58: error: cannot convert 'std::vector<int>::iterator' to 'int*' 46 | place = my_find(max, result.begin()); | ~~~~~~~~~~~~^~ | | | std::vector<int>::iterator a.cc:7:26: note: initializing argument 2 of 'int my_find(int, int*)' 7 | int my_find(int val, int res[]) | ~~~~^~~~~
s744970531
p00428
C++
#include<iostream> #include<vector> using namespace std; int n, m; int my_find(int val, int res[]) { for(int i = 0; i < m; i++){ if(res[i] == val){ return i; } } return 0; } int main() { int ank[1000][100]; int max, place; vector<int> result_sort(m, 0); vector<int> result(m, 0); for(;;){ cin >> n; cin >> m; if(n == 0 && m == 0){ break; } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> ank[i][j]; } } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ result[i] += ank[j][i]; } } for(int i = 0; i < m; i++){ max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo place = my_find(max, result.begin()); result_sort[i] = place; //êŠ‚ð‘ã“ü result[place] = 0; //Å‘å’l‚Ì‚ ‚Á‚½êŠ‚ð0‚ŏ‘‚«Š·‚¦‚é } for(int i = 0; i < m; i++){ cout << result_sort[i]+1; } printf("\n"); } }
a.cc: In function 'int main()': a.cc:44:32: error: 'max_element' was not declared in this scope 44 | max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo | ^~~~~~~~~~~ a.cc:45:58: error: cannot convert 'std::vector<int>::iterator' to 'int*' 45 | place = my_find(max, result.begin()); | ~~~~~~~~~~~~^~ | | | std::vector<int>::iterator a.cc:7:26: note: initializing argument 2 of 'int my_find(int, int*)' 7 | int my_find(int val, int res[]) | ~~~~^~~~~
s242462201
p00428
C++
#include<iostream> #include<vector> #include<algorithm> using namespace std; int n, m; int my_find(int val, int res[]) { for(int i = 0; i < m; i++){ if(res[i] == val){ return i; } } return 0; } int main() { int ank[1000][100]; int max, place; vector<int> result_sort(m, 0); vector<int> result(m, 0); for(;;){ cin >> n; cin >> m; if(n == 0 && m == 0){ break; } for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ cin >> ank[i][j]; } } for(int i = 0; i < m; i++){ for(int j = 0; j < n; j++){ result[i] += ank[j][i]; } } for(int i = 0; i < m; i++){ max = *max_element(result.begin(), result.end()); //‚±‚ÌŽž“_‚ł̍őå’l‚ðŒŸo place = my_find(max, result.begin()); result_sort[i] = place; //êŠ‚ð‘ã“ü result[place] = 0; //Å‘å’l‚Ì‚ ‚Á‚½êŠ‚ð0‚ŏ‘‚«Š·‚¦‚é } for(int i = 0; i < m; i++){ cout << result_sort[i]+1; } printf("\n"); } }
a.cc: In function 'int main()': a.cc:46:58: error: cannot convert 'std::vector<int>::iterator' to 'int*' 46 | place = my_find(max, result.begin()); | ~~~~~~~~~~~~^~ | | | std::vector<int>::iterator a.cc:8:26: note: initializing argument 2 of 'int my_find(int, int*)' 8 | int my_find(int val, int res[]) | ~~~~^~~~~
s377960982
p00428
C++
#include<cstdio> #include<cstdlib> int main(){ int a,b,d; FILE *fp,*fq; fp=fopen("input.txt","r"); while(1){ fscanf(fp,"%d%d",&a,&b); if(a==0) break; int as[b]; for(int j=0;j<a;j++) for(int i=0;i<b;i++) { fscanf(fp,"%d",d); if(d) as[b]++; } } for(int i=0;i<b-1;i++) { for(int j=i+1;j<b;j++) if(as[i]<as[j]){ d=as[i]; as[i]=as[j]; as[j]=d; } } fq=fopen("output.txt","w"); for(int i=0;i<b;i++) fprintf(fq,"%d ",as[i]); fprintf(fq,"\n"); } return 0; }
a.cc: In function 'int main()': a.cc:22:12: error: 'as' was not declared in this scope; did you mean 'a'? 22 | if(as[i]<as[j]){ | ^~ | a a.cc:30:22: error: 'as' was not declared in this scope; did you mean 'a'? 30 | fprintf(fq,"%d ",as[i]); | ^~ | a a.cc: At global scope: a.cc:34:3: error: expected unqualified-id before 'return' 34 | return 0; | ^~~~~~ a.cc:35:1: error: expected declaration before '}' token 35 | } | ^
s702320255
p00428
C++
#include<stdio.h> typedef struct tagDATA { int num; int cnt; } DATA; int cmp(const void* a,const void* b); int cmp(const void* a,const void* b) { return (((DATA*)a)->cnt)-(((DATA*)b)->cnt); } int main(){ int n,m,i,j,t; DATA dat[100]; FILE *ip,*op; freopen("input.txt","r",ip); freopen("output.txt","a+",op); while(1) { scanf("%d%d",&n,&m); if(n==0&&m==0)break; for(j=0;j<m;j++) { dat[j].num=j+1; dat[j].cnt=0; } for(i=0;i<n;i++) { for(j=0;j<m;j++) { scanf("%d",&t); if(t)dat[j].cnt++; } } qsort(&dat,m,sizeof(DATA),cmp); for(j=0;j<m;j++) { printf("%d ",dat[j].num); } printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:39:17: error: 'qsort' was not declared in this scope 39 | qsort(&dat,m,sizeof(DATA),cmp); | ^~~~~
s182256911
p00428
C++
#include <iostream> #include <map> #include <set> #include <algorithm> #include <vector> using namespace std; int main(){ int n,m; while(cin >> n >> m && !(n == 0 && m == 0)){ vector<int> v(m,0); for(int i = 0; i < n; i++){ for(int j = 0; j < m; j++){ int p; cin >> p; if(p) v[j]++; } } vector<pair<int,int > > v2; for(int i = 0; i < v.size(); i++){ v2.push_back(make_pair(v[i],-i)); } sort(v2.begin(),v2.end(),greater<pair<int,int>ツ >()); for(int i = 0; i < v2.size(); i++){ cout << -(v2[i].second-1) << " "; } cout << endl; } return 0; }
a.cc:27:63: error: extended character   is not valid in an identifier 27 | sort(v2.begin(),v2.end(),greater<pair<int,int>ツ >()); | ^ a.cc: In function 'int main()': a.cc:27:67: error: template argument 1 is invalid 27 | sort(v2.begin(),v2.end(),greater<pair<int,int>ツ >()); | ^
s838017295
p00428
C++
#include<iostream> #include<algorithm> #include<utility> using namespace std; bool operator<( const pair<int,int> &l, const pair<int,int> &r ){ return l.second < r.second; } int main(){ int n, m; while( cin >> n >> m, n||m ){ vector< pair<int, int> > res; res.resize(m); for( int i=0; i<m; i++ ){ res[i].first = i+1; res[i].second = 0; } for( int i=0; i<n; i++ ){ for( int j=0; j<m; j++ ){ int k; cin >> k; if( k == 1 ){ res[j].second++; } } } sort( res.rbegin(), res.rend() ); cout << res[0]; for( int i=1; i<m; i++ ){ cout << " " << res[i].first; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:17: error: 'vector' was not declared in this scope 13 | vector< pair<int, int> > res; | ^~~~~~ a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>' 3 | #include<utility> +++ |+#include <vector> 4 | using namespace std; a.cc:13:40: error: expected primary-expression before '>' token 13 | vector< pair<int, int> > res; | ^ a.cc:13:42: error: 'res' was not declared in this scope 13 | vector< pair<int, int> > res; | ^~~
s104343051
p00428
C++
#include<iostream> #include<vector> #include<algorithm> #include<utility> using namespace std; bool operator<( const pair<int,int> &l, const pair<int,int> &r ){ return l.second < r.second; } int main(){ int n, m; while( cin >> n >> m, n||m ){ vector< pair<int, int> > res; res.resize(m); for( int i=0; i<m; i++ ){ res[i].first = i+1; res[i].second = 0; } for( int i=0; i<n; i++ ){ for( int j=0; j<m; j++ ){ int k; cin >> k; if( k == 1 ){ res[j].second++; } } } sort( res.rbegin(), res.rend() ); cout << res[0]; for( int i=1; i<m; i++ ){ cout << " " << res[i].first; } cout << endl; } return 0; }
a.cc: In function 'int main()': a.cc:30:22: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'}) 30 | cout << res[0]; In file included from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'} 116 | operator<<(__ostream_type& (*__pf)(__ostream_type&)) | ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]' 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ^~~~~~~~ /usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} 125 | operator<<(__ios_type& (*__pf)(__ios_type&)) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ^~~~~~~~ /usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'std::ios_base& (*)(std::ios_base&)' 135 | operator<<(ios_base& (*__pf) (ios_base&)) | ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~ /usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 174 | operator<<(long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'long int' 174 | operator<<(long __n) | ~~~~~^~~ /usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 178 | operator<<(unsigned long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'long unsigned int' 178 | operator<<(unsigned long __n) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 182 | operator<<(bool __n) | ^~~~~~~~ /usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'bool' 182 | operator<<(bool __n) | ~~~~~^~~ In file included from /usr/include/c++/14/ostream:1022: /usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]' 96 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'short int' 97 | operator<<(short __n) | ~~~~~~^~~ /usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 189 | operator<<(unsigned short __n) | ^~~~~~~~ /usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'short unsigned int' 189 | operator<<(unsigned short __n) | ~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]' 110 | basic_ostream<_CharT, _Traits>:: | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'int' 111 | operator<<(int __n) | ~~~~^~~ /usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 200 | operator<<(unsigned int __n) | ^~~~~~~~ /usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'unsigned int' 200 | operator<<(unsigned int __n) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 211 | operator<<(long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'long long int' 211 | operator<<(long long __n) | ~~~~~~~~~~^~~ /usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 215 | operator<<(unsigned long long __n) | ^~~~~~~~ /usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'long long unsigned int' 215 | operator<<(unsigned long long __n) | ~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 231 | operator<<(double __f) | ^~~~~~~~ /usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'double' 231 | operator<<(double __f) | ~~~~~~~^~~ /usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 235 | operator<<(float __f) | ^~~~~~~~ /usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type' {aka 'std::pair<int, int>'} to 'float' 235 | operator<<(float __f) | ~~~~~~^~~ /usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]' 243 | operator<<(long double __f) | ^~~~~~~~ /usr/include/c+
s850267028
p00428
C++
#include"functions.h" int n,m; int i,j; int req[100],no[100]; int d; void sort(int a[], int n,int b[]){ int x; for(i=n-1;i>0;i--){ for(j=0;j<i;j++){ if(a[j]>a[j+1]){ x=a[j]; a[j]=a[j+1]; a[j+1]=x; x=b[j]; b[j]=b[j+1]; b[j+1]=x; } else if(a[j]==a[j+1])if(b[j]<b[j+1]){ x=b[j]; b[j]=b[j+1]; b[j+1]=x; } } } } int main(){ while(1){ scanf("%d %d",&n,&m); if(n==0&&m==0)return 0; for(i=0;i<m;i++)req[i]=0; for(i=0;i<m;i++)no[i]=i+1; for(i=0;i<n;i++)for(j=0;j<m;j++){ scanf("%d",&d); if(d==1)req[j]++; } sort(req,m,no); for(i=m-1;i>=0;i--)printf("%d ",no[i]); printf("\n"); } }
a.cc:1:9: fatal error: functions.h: No such file or directory 1 | #include"functions.h" | ^~~~~~~~~~~~~ compilation terminated.
s252443866
p00428
C++
#include"functions.h" int n,m; int i,j; int req[100],no[100]; int d; void sort(int a[], int n,int b[]){ int x; for(i=n-1;i>0;i--){ for(j=0;j<i;j++){ if(a[j]>a[j+1]){ x=a[j]; a[j]=a[j+1]; a[j+1]=x; x=b[j]; b[j]=b[j+1]; b[j+1]=x; } else if(a[j]==a[j+1])if(b[j]<b[j+1]){ x=b[j]; b[j]=b[j+1]; b[j+1]=x; } } } } int main(){ while(1){ scanf("%d %d",&n,&m); if(n==0&&m==0)return 0; for(i=0;i<m;i++)req[i]=0; for(i=0;i<m;i++)no[i]=i+1; for(i=0;i<n;i++)for(j=0;j<m;j++){ scanf("%d",&d); if(d==1)req[j]++; } sort(req,m,no); for(i=m-1;i>=0;i--)printf("%d ",no[i]); printf("\n"); } }
a.cc:1:9: fatal error: functions.h: No such file or directory 1 | #include"functions.h" | ^~~~~~~~~~~~~ compilation terminated.
s004899345
p00428
C++
#include<stdio.h> int n,m; int i,j; int req[100],no[100]; int d; void sort(int a[], int n,int b[]){ int x; for(i=n-1;i>0;i--){ for(j=0;j<i;j++){ if(a[j]>a[j+1]){ x=a[j]; a[j]=a[j+1]; a[j+1]=x; x=b[j]; b[j]=b[j+1]; b[j+1]=x; } else if(a[j]==a[j+1])if(b[j]<b[j+1]){ x=b[j]; b[j]=b[j+1]; b[j+1]=x; } } } } int main(){ while(1){ scanf("%d %d",&n,&m); if(n==0&&m==0)return 0; for(i=0;i<m;i++)req[i]=0; for(i=0;i<m;i++)no[i]=i+1; for(i=0;i<n;i++)for(j=0;j<m;j++){ scanf("%d",&d); if(d==1)req[j]++; } sort(req,m,no); for(i=m-1;i>=0;i--){ printf("%d",no[i]); if(i!=0)printf(" "); printf("\n"); } }
a.cc: In function 'int main()': a.cc:44:2: error: expected '}' at end of input 44 | } | ^ a.cc:28:11: note: to match this '{' 28 | int main(){ | ^
s780780537
p00428
C++
#include<iostream> using namespace std; int main(){ int n,m,a,b; int sum[100]; int big[100]; while(cin>>n>>m){ for(int i=0;i<100;i++){ sum[i]=0;} b=0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a; sum[j]+=a;}} for(int i=1000;i>-1;i--){ for(int j=0;j<m;j++){ if(i==sum[j]){ if(b!=m-1){ cout<<j+1<<" ";} if(b==m-1){ cout<<j+1<<endl;} b++;}} }}
a.cc: In function 'int main()': a.cc:24:3: error: expected '}' at end of input 24 | }} | ^ a.cc:4:11: note: to match this '{' 4 | int main(){ | ^
s769919675
p00428
C++
#include <iostream> #include <algorithm> #include <functional> using namespace std; int main(){ int n; int m; int b; int c; int d; while(cin >>n){ cin >>m; if(n==0){break;} int a[m]; b=0; while(b<m){ a[b]=0; b=b+1;} b=0; while(b<n){ c=0; while(c<m){ cin >>d; if(d==1){a[c]=a[c]+1;} c=c+1;} b=b+1;} stable_sort(a.begin(),a.end(),greater<int>() ); b=0; while(b<m){ cout <<a[b]; if(b==m-1){cout <<endl;} else{cout <<" "} } } }
a.cc: In function 'int main()': a.cc:27:15: error: request for member 'begin' in 'a', which is of non-class type 'int [m]' 27 | stable_sort(a.begin(),a.end(),greater<int>() ); | ^~~~~ a.cc:27:25: error: request for member 'end' in 'a', which is of non-class type 'int [m]' 27 | stable_sort(a.begin(),a.end(),greater<int>() ); | ^~~ a.cc:32:16: error: expected ';' before '}' token 32 | else{cout <<" "} | ^ | ;
s599516606
p00428
C++
#include <stdio.h> int hyou[100]; void main() { int m,n; int zyuni[100]; FILE *fo,*fc; fo = fopen("input.txt","r"); fc = fopen("output.txt","w"); fscanf(fo,"%d %d",&m,&n); for(int i=0; i<m; i++){ for(int j=1; j<=n; j++){ int kari; fscanf(fo,"%d",&kari); hyou[j] += kari; } } for(int i=1;i<=n;i++) zyuni[i]=1; for(int i=2; i<=n; i++){ for(int j=1; j<=i-1 ; j++){ if(hyou[j]>hyou[i]) zyuni[i]++; if(hyou[j]<hyou[i]) zyuni[j]++; if(hyou[j]==hyou[i]) zyuni[i]++; } } for(int i=1; i<=n; i++) fprintf(fc,"%d\n",zyuni[i]); fclose(fo); fclose(fc); }
a.cc:5:1: error: '::main' must return 'int' 5 | void main() | ^~~~
s422112165
p00428
C++
#include <cstdio> int hyou[100]; int main() { int m,n; int zyuni[100];#include <cstdio> int hyou[100]; int main() { int m,n; int zyuni[100]; while(1){ scanf("%d %d",&m,&n); if(m==0&&n==0) break; for(int i=0; i<m; i++){ for(int j=1; j<=n; j++){ int kari; scanf("%d",&kari); hyou[j] += kari; } } for(int i=1;i<=n;i++) zyuni[i]=1; for(int i=2; i<=n; i++){ for(int j=1; j<=i-1 ; j++){ if(hyou[j]>hyou[i]) zyuni[i]++; if(hyou[j]<hyou[i]) zyuni[j]++; if(hyou[j]==hyou[i]) zyuni[i]++; } } for(int i=1; i<=n; i++) printf("%d ",zyuni[i]); } } while(1){ scanf("%d %d",&m,&n); if(m==0&&n==0) break; for(int i=0; i<m; i++){ for(int j=1; j<=n; j++){ int kari; scanf("%d",&kari); hyou[j] += kari; } } for(int i=1;i<=n;i++) zyuni[i]=1; for(int i=2; i<=n; i++){ for(int j=1; j<=i-1 ; j++){ if(hyou[j]>hyou[i]) zyuni[i]++; if(hyou[j]<hyou[i]) zyuni[j]++; if(hyou[j]==hyou[i]) zyuni[i]++; } } for(int i=1; i<=n; i++) printf("%d ",zyuni[i]); puts(""); } }
a.cc:8:24: error: stray '#' in program 8 | int zyuni[100];#include <cstdio> | ^ a.cc: In function 'int main()': a.cc:8:25: error: 'include' was not declared in this scope 8 | int zyuni[100];#include <cstdio> | ^~~~~~~ a.cc:8:34: error: 'cstdio' was not declared in this scope; did you mean 'stdin'? 8 | int zyuni[100];#include <cstdio> | ^~~~~~ | stdin a.cc:10:1: error: expected primary-expression before 'int' 10 | int hyou[100]; | ^~~ a.cc:12:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 12 | int main() | ^~ a.cc:12:9: note: remove parentheses to default-initialize a variable 12 | int main() | ^~ | -- a.cc:12:9: note: or replace parentheses with braces to value-initialize a variable a.cc:13:1: error: a function-definition is not allowed here before '{' token 13 | { | ^
s702790559
p00428
C++
#include<cstdio> #include<iostream> #include<algorithm> #include<string> using namespace std; int main(){ while(true){ int n, m, i ,j; int p[100]; for(i = 0; i < 100; i++) p[i] = -1; cin >> n >> m; if(!n) break; for(i = 0; i < n; i++){ for(j = 0; j < m; j ++){ int input; cin >> input; p[j] += input; } } for(i = 1000; i >= 0; i--){ for(j = 0; j < m; j++){ if(p[j] == i){ printf("%d", j + 1); if(j < m - 1) else printf("\n"); } } } } return 0; }
a.cc: In function 'int main()': a.cc:29:11: error: expected primary-expression before 'else' 29 | else printf("\n"); | ^~~~
s190137064
p00428
C++
#include <stdio.h> #include <vector> #include <utility> #include <algorithm> #include <functional> using namespace std; struct int_pair_more { bool operator()(const pair<int,int>& x, const pair<int,int> return x.second > y.second; } }; vector<pair<int,int> > answer(100); int main() { while(1){ int n,m; scanf("%d %d", &n, &m); if(n == 0 && m ==0)return 0; for(int j=0;j<m;j++)answer[j] = make_pair(j, 0); for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ int tmp; scanf("%d",&tmp); answer[j].second += tmp; } } sort( answer.begin(), answer.end(), int_pair_more()); for (int i=0;i<m-1;i++){ printf("%d ", answer[i].first+1); } printf("%d\n", answer[m-1].first+1); } }
a.cc:11:5: error: expected ',' or '...' before 'return' 11 | return x.second > y.second; | ^~~~~~ a.cc:11:31: error: expected ')' before ';' token 11 | return x.second > y.second; | ^ | ) a.cc:10:18: note: to match this '(' 10 | bool operator()(const pair<int,int>& x, const pair<int,int> | ^ a.cc:12:4: error: expected ';' after struct definition 12 | } | ^ | ; a.cc:13:1: error: expected declaration before '}' token 13 | }; | ^
s818287958
p00428
C++
z/********************************************** 1. 2.炭田高輝 3.sumita.takaki@gmail.com last updated: 2013-07-10@19:30 **********************************************/ #include<iostream> #include<algorithm> #include<sstream> #include<vector> #include<queue> #include<deque> #include<map> #include<set> #include<string> #include<cstdio> #include<cmath> #include<cstring> #include<cctype> using namespace std; int main(void){ int number = 0; int place_num = 0; int frag = 0; cin >> number >> place_num; int num = place_num; int vote[number][place_num]; vector<int> total(num); vector<int> tmp_total(num); vector<int> pos(num); vector<int> order(num); for(int i=0; i<number; i++){ for(int j=0; j<place_num; j++){ cin >> vote[i][j]; } } for(int i=0; i<place_num; i++){ for(int j=0; j<number; j++){ tmp_total[i] = tmp_total[i] + vote[j][i]; } total[i] = tmp_total[i]; } sort(tmp_total.begin(), tmp_total.end()); for(int i=0; i<place_num; i++){ for(int j=0; j < place_num; j++){ if(tmp_total[place_num - i-1] == total[j]){ for(int k=0; k<i; k++){ if(order[k] == j+1){ frag =1; break; }else{ frag =0; } } if(frag==0){ order[i] = j+1; break; }else{ frag=0; } } } } for(int i=0; i<place_num; i++){ cout << order[i]; } cout << endl; return 0; }
a.cc:1:1: error: 'z' does not name a type 1 | z/********************************************** | ^ In file included from /usr/include/c++/14/iosfwd:42, from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:10: /usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type 68 | typedef ptrdiff_t streamsize; // Signed integral type | ^~~~~~~~~ /usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>' 40 | #include <cwchar> // For mbstate_t +++ |+#include <cstddef> 41 | In file included from /usr/include/c++/14/bits/exception_ptr.h:38, from /usr/include/c++/14/exception:166, from /usr/include/c++/14/ios:41: /usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ In file included from /usr/include/wchar.h:35, from /usr/include/c++/14/cwchar:44, from /usr/include/c++/14/bits/postypes.h:40: /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive] 132 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~~~ /usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive] 134 | __attribute__((__externally_visible__)); | ^ /usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared 140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared 142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~ /usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:145:52: error: expected primary-expression before 'const' 145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:147:54: error: expected primary-expression before 'const' 147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT | ^~~~~ /usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token 154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive] 155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:156:70: error: expected primary-expression before 'const' 156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~~~ /usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token 162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t) | ^ /usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive] 163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__)); | ^ /usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~~~ /usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'? 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~~ /usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here 214 | typedef __SIZE_TYPE__ size_t; | ^~~~~~ /usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^ /usr/include/c++/14/new:164:72: error: expected primary-expression before 'const' 164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&) | ^~~~~ /usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared 171 | void operator delete(void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared 173 | void operator delete[](void*, std::size_t, std::align_val_t) | ^~~ /usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function 179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ /usr/include/c++/14/new:179:51: error: 'size_t' is not a member of 'std'; did you mean 'size_t
s294326213
p00428
C++
while true do n, m = gets.split.map {|x| x.to_i } if n == 0 && m == 0 then break; end location = Hash.new{|h, k| h[k] = 0 } n.times do gets.split.map {|x| x.to_i }.each_with_index {|x, i| location[i+1] += x } end puts location.sort {|a,b| b[1] <=> a[1] }.map {|x| x[0] }.join ' ' end
a.cc:1:1: error: expected unqualified-id before 'while' 1 | while true do | ^~~~~ a.cc:3:3: error: expected unqualified-id before 'if' 3 | if n == 0 && m == 0 then | ^~ a.cc:5:3: error: 'end' does not name a type 5 | end | ^~~ a.cc:7:3: error: 'n' does not name a type 7 | n.times do | ^ a.cc:8:33: error: expected unqualified-id before '.' token 8 | gets.split.map {|x| x.to_i }.each_with_index {|x, i| location[i+1] += x } | ^ a.cc:9:3: error: 'end' does not name a type 9 | end | ^~~ a.cc:10:44: error: expected unqualified-id before '.' token 10 | puts location.sort {|a,b| b[1] <=> a[1] }.map {|x| x[0] }.join ' ' | ^ a.cc:10:60: error: expected unqualified-id before '.' token 10 | puts location.sort {|a,b| b[1] <=> a[1] }.map {|x| x[0] }.join ' ' | ^
s749471478
p00428
C++
#include <iostream> #include <functional> #include <map> #include <stack> #include <vector> #include <string> #include <algorithm> #include <math.h> #include <deque> using namespace std; int main() { vector<pair<int,int> > place; int n,m,count[101] = {1000},ans[1001][100]; while(1) { cin>>n>>m; if(n == 0 && m == 0)break; for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ cin>>ans[i][j]; } } for(int i=1; i<=n; i++){ for(int j=1; j<=m; j++){ if(ans[i][j]) count[j]--; } } for(int i=m; i>0; i--) place.push_back(make_pair(count[i],i)); stable_sort(place.begin(),place.end()); } vector<pair<int,int> >::iterator it = place.begin(); while(it != place.end()) { cout<<(*it).second<<endl; ++it; } vector<pair<int,int> >::iterator it = place.begin(); while(it != place.end()) { cout<<(*it).second<<endl; ++it; } return 0; }
a.cc: In function 'int main()': a.cc:48:42: error: redeclaration of 'std::vector<std::pair<int, int> >::iterator it' 48 | vector<pair<int,int> >::iterator it = place.begin(); | ^~ a.cc:41:42: note: 'std::vector<std::pair<int, int> >::iterator it' previously declared here 41 | vector<pair<int,int> >::iterator it = place.begin(); | ^~
s255369221
p00429
Java
public class Main { public static void main(String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while(true){ String line[] = br.readLine().split(" "); int n = Integer.parseInt(line[0]); if(n==0){break;} String answer = br.readLine().split(" ")[0]; for(int i=0; i<n; i++){ String result = ""; char previous = 0; int count = 0; for(int j=0; j<answer.length(); j++){ char now = answer.charAt(j); if(now == previous){ count++; }else{ if(count!=0){result += count; result += previous;} previous = now; count = 1; } } result += count; result += previous; answer = result; } System.out.println(answer); } } }
Main.java:2: error: cannot find symbol public static void main(String[] args)throws IOException { ^ symbol: class IOException location: class Main Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class BufferedReader location: class Main Main.java:3: error: cannot find symbol BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ^ symbol: class InputStreamReader location: class Main 4 errors
s883422312
p00429
Java
public class Q_0506 { public static void main(String[] args){ if(args.length < 2){ System.err.println("too few argument"); return; } String numCode = args[1]; for(int i=0; i<Integer.parseInt(args[0]); i++) numCode = zip(numCode); System.out.println(numCode); } static String zip(String numCode){ if(numCode.length() == 0) return ""; char top = numCode.charAt(0); String underCode = numCode.substring(1); int i; for(i=0; i<underCode.length(); i++){ if(top != underCode.charAt(i)) break; } return (i+1) + String.valueOf(top) + zip(underCode.substring(i)); } }
Main.java:1: error: class Q_0506 is public, should be declared in a file named Q_0506.java public class Q_0506 { ^ 1 error
s252399558
p00429
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args){ try{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true){ String count = in.readLine(); if( count.equals("0") ) break; String numCode = in.readLine(); try{ for(int i=0; i<Integer.parseInt(count); i++) numCode = zip(numCode); System.out.println(numCode); }catch(StackOverFlowException e){ e.printStackTrace(); } } }catch(IOException e){ e.printStackTrace(); } } static String zip(String numCode){ if(numCode.length() == 0) return ""; char top = numCode.charAt(0); String underCode = numCode.substring(1); int i; for(i=0; i<underCode.length(); i++){ if(top != underCode.charAt(i)) break; } return (i+1) + String.valueOf(top) + zip(underCode.substring(i)); } }
Main.java:18: error: cannot find symbol }catch(StackOverFlowException e){ ^ symbol: class StackOverFlowException location: class Main 1 error
s661120906
p00429
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args){ try{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true){ String count = in.readLine(); if( count.equals("0") ) break; String numCode = in.readLine(); try{ for(int i=0; i<Integer.parseInt(count); i++) numCode = zip(numCode); System.out.println(numCode); }catch(StackOverFlowError e){ e.printStackTrace(); } } }catch(IOException e){ e.printStackTrace(); } } static String zip(String numCode){ if(numCode.length() == 0) return ""; char top = numCode.charAt(0); String underCode = numCode.substring(1); int i; for(i=0; i<underCode.length(); i++){ if(top != underCode.charAt(i)) break; } return (i+1) + String.valueOf(top) + zip(underCode.substring(i)); } }
Main.java:18: error: cannot find symbol }catch(StackOverFlowError e){ ^ symbol: class StackOverFlowError location: class Main 1 error
s160470905
p00429
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args){ StringBuilder result = new StringBuilder(); try{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true){ String count = in.readLine(); if( count.equals("0") || Integer.parseInt(count) > 20 ) break; String numCode = in.readLine(); if( numCode.length() > 100 ) break; for(int i=0; i<Integer.parseInt(count); i++) numCode = zip(numCode); result.append(numCode + "\n"); } }catch(IOException e){ e.printStackTrace(); } System.out.println(result); } static String zip(String numCode){ if(numCode.length() == 0) return ""; char top = numCode.charAt(0); String underCode = numCode.substring(1); int i; for(i=0; i<underCode.length(); i++){ if(top != underCode.charAt(i)) break; } return (i+1) + String.valueOf(top) + zip(underCode.substring(i)); } }\
Main.java:42: error: illegal character: '\' }\ ^ Main.java:42: error: reached end of file while parsing }\ ^ 2 errors
s180578758
p00429
Java
import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Main { public static void main(String[] args){ StringBuilder result = new StringBuilder(); bool flag = false; try{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true){ String count = in.readLine(); if( count.equals("0") || Integer.parseInt(count) > 20 ) break; String numCode = in.readLine(); if( numCode.length() > 100 ) break; for(int i=0; i<Integer.parseInt(count); i++) numCode = zip(numCode); result.append(numCode + "\n"); } }catch(IOException e){ e.printStackTrace();flag=true; }catch(RuntimeException e){System.out.println("HOGE");flag=true;} if(!flag)System.out.print(result); } static String zip(String numCode){ if(numCode.length() == 0) return ""; char top = numCode.charAt(0); String underCode = numCode.substring(1); int i; for(i=0; i<underCode.length(); i++){ if(top != underCode.charAt(i)) break; } return (i+1) + String.valueOf(top) + zip(underCode.substring(i)); } }
Main.java:8: error: cannot find symbol bool flag = false; ^ symbol: class bool location: class Main 1 error
s184766315
p00429
C
#include <cstdio> #include <iostream> typedef struct { char number; char num; } NUMBER; NUMBER N[2048]; using namespace std; int main() { char str[2048]; int n; while (cin >> n, n){ cin >> str; memset(N, 0, sizeof(N)); for (int c = 0; c < n; c++){ int i = 0; int j = 0; while (str[i] != '\0'){ if (i > 0 && str[i] == str[i-1]){ N[j-1].num++; } else { N[j].number = str[i]; N[j].num = '1'; j++; } i++; } strcpy(str, ""); for (int i = 0; i < j; i++){ strncat(str, &N[i].number, 1); strncat(str, &N[i].num, 1); } } printf("%s\n", str); } return (0); }
main.c:1:10: fatal error: cstdio: No such file or directory 1 | #include <cstdio> | ^~~~~~~~ compilation terminated.
s124454873
p00429
C
#include<stdio.h> int main(void){ int n,i,j,count; char s[101],t[101]; while(scanf("%d".&n),n){ count=0; scanf("%s",s); while(n--){ for(i=0;s[i]!='\0';i++){ for(j=0;s[i]==s[j];j++); if(j>99){ t[count++]=j/100; j%=100; t[count++]=j/10; j%=10; t[count++]=j; t[count++]=s[i]; }else if(j>9){ t[count++]=j/10; j%=10; t[count++]=j; t[count++]=s[i]; }else{ t[count++]=j; t[count++]=s[i]; } i=j; } for(i=0;i<101;i++){ s[i]=t[i]; t[i]=0; } } printf("%s\n",s); } return 0; }
main.c: In function 'main': main.c:7:26: error: expected identifier before '&' token 7 | while(scanf("%d".&n),n){ | ^
s007710073
p00429
C
#include <stdio.h> #include <string.h> ?? int main(void) { ????int n; ????char s[364364], tmp[364364], res[364364]; ????int i, j; ????int cnt, len; ?? ????while (scanf("%d", &n), n){ ????????scanf("%s", s); ????????for (i = 0; i < n; i++){ ????????????cnt = 1; ????????????*res = '\0'; ????????????len = strlen(s); ????????????for (j = 0; j < len; j++){ ????????????????if (s[j] == s[j + 1]){ ????????????????????cnt++; ????????????????} ????????????????else { ????????????????????sprintf(tmp, "%d%c", cnt, s[j]); ????????????????????strcat(res, tmp); ????????????????????cnt = 1; ????????????????} ????????????} ????????????strcpy(s, res); ????????} ????????printf("%s\n", s); ????} ?? ????return (0); }
main.c:3:1: error: expected identifier or '(' before '?' token 3 | ?? | ^
s076227493
p00429
C
char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;}
main.c:1:24: warning: data definition has no type or storage class 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^ main.c:1:24: error: type defaults to 'int' in declaration of 'c' [-Wimplicit-int] main.c:1:26: error: type defaults to 'int' in declaration of 'l' [-Wimplicit-int] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^ main.c:1:28: error: type defaults to 'int' in declaration of 'i' [-Wimplicit-int] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^ main.c:1:30: error: return type defaults to 'int' [-Wimplicit-int] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~ main.c: In function 'main': main.c:1:30: error: type of 'n' defaults to 'int' [-Wimplicit-int] main.c:1:43: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} main.c:1:43: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~ main.c:1:43: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:60: error: implicit declaration of function 'puts' [-Wimplicit-function-declaration] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~ main.c:1:60: note: include '<stdio.h>' or provide a declaration of 'puts' main.c:1:90: error: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~~ main.c:1:1: note: include '<string.h>' or provide a declaration of 'strcpy' +++ |+#include <string.h> 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} main.c:1:90: warning: incompatible implicit declaration of built-in function 'strcpy' [-Wbuiltin-declaration-mismatch] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~~ main.c:1:90: note: include '<string.h>' or provide a declaration of 'strcpy' main.c:1:130: error: implicit declaration of function 'sprintf' [-Wimplicit-function-declaration] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~~~ main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'sprintf' main.c:1:130: warning: incompatible implicit declaration of built-in function 'sprintf' [-Wbuiltin-declaration-mismatch] main.c:1:130: note: include '<stdio.h>' or provide a declaration of 'sprintf' main.c:1:167: error: implicit declaration of function 'strlen' [-Wimplicit-function-declaration] 1 | char*p,s[9999],t[9999];c,l,i;main(n){for(;scanf("%d",&n)*n;puts(s))for(scanf("%s",s);n--;strcpy(s,t))for(c=*s,p=t,l=i=0;c;c=s[i])sprintf(p,"%d%c",++l,c),s[++i]-c?p=t+strlen(t,l=0):0;} | ^~~~~~ main.c:1:167: note: include '<string.h>' or provide a declaration of 'strlen' main.c:1:167: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch] main.c:1:167: note: include '<string.h>' or provide a declaration of 'strlen' main.c:1:167: error: too many arguments to function 'strlen'
s044275021
p00429
C
#include <stdio.h> #include <string.h> int main(){ for(;;){ char str[100000],strcopy[100000]; int a,b=0,sum=1,leng; scanf("%d",&a); if(a==0) break; scanf("%s",str); leng=strlen(str); for(j=0;j<a;j++){ for(i=1;i<strlen(str);i++){ if(str[i-1]==str[i]){ sum++; }else{ if(sum>=10){ strcopy[b]=sum/10+'0'; strcopy[b+1]=sum%10+'0'; strcopy[b+2]=str[i-1]; b+=3; sum=1; }else{ strcopy[b]=sum+'0'; strcopy[b+1]=str[i-1]; b+=2; sum=1; } } } if(sum>=10){ strcopy[b]=sum/10+'0'; strcopy[b+1]=sum%10+'0'; strcopy[b+2]=str[strlen(str)-1]; b+=3; sum=1; }else{ strcopy[b]=sum+'0'; strcopy[b+1]=str[strlen(str)-1]; b+=2; sum=1; } leng=strlen(strcopy); strcpy(str,""); strncpy(str,strcopy,leng); strcpy(strcopy,""); b=0; } puts(str); } return 0; }
main.c: In function 'main': main.c:11:9: error: 'j' undeclared (first use in this function) 11 | for(j=0;j<a;j++){ | ^ main.c:11:9: note: each undeclared identifier is reported only once for each function it appears in main.c:12:9: error: 'i' undeclared (first use in this function) 12 | for(i=1;i<strlen(str);i++){ | ^
s189620806
p00429
C
#include<stdio.h> #include<string.h> char StrCount(); main(void){ int i = 0, m, num, cnt = 0; char str[100], target; scanf("%d", &num); scanf("%s", str); for( ; num > 0; num--){ str = StrCount(str); } return 0; } char StrCount(char str[100]){ int i =0, m, cnt = 0; char target,restr[100]; target = str[0]; for( m = strlen(str); i <= m; i++){ if( target == str[i]){ cnt++; }else{ if( i == 0){ strncat(restr, '1', 101); strncat(restr, str[0], 101); target = str[1]; }else{ strncat(restr, (char)cnt, 101); strncat(restr, str[0],101); target = str[i]; } } } return restr; }
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int] 6 | main(void){ | ^~~~ main.c: In function 'main': main.c:14:13: error: assignment to expression with array type 14 | str = StrCount(str); | ^ main.c: In function 'StrCount': main.c:30:32: error: passing argument 2 of 'strncat' makes pointer from integer without a cast [-Wint-conversion] 30 | strncat(restr, '1', 101); | ^~~ | | | int In file included from main.c:2: /usr/include/string.h:152:71: note: expected 'const char * restrict' but argument is of type 'int' 152 | extern char *strncat (char *__restrict __dest, const char *__restrict __src, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ main.c:31:35: error: passing argument 2 of 'strncat' makes pointer from integer without a cast [-Wint-conversion] 31 | strncat(restr, str[0], 101); | ~~~^~~ | | | char /usr/include/string.h:152:71: note: expected 'const char * restrict' but argument is of type 'char' 152 | extern char *strncat (char *__restrict __dest, const char *__restrict __src, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ main.c:34:32: error: passing argument 2 of 'strncat' makes pointer from integer without a cast [-Wint-conversion] 34 | strncat(restr, (char)cnt, 101); | ^~~~~~~~~ | | | char /usr/include/string.h:152:71: note: expected 'const char * restrict' but argument is of type 'char' 152 | extern char *strncat (char *__restrict __dest, const char *__restrict __src, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ main.c:35:35: error: passing argument 2 of 'strncat' makes pointer from integer without a cast [-Wint-conversion] 35 | strncat(restr, str[0],101); | ~~~^~~ | | | char /usr/include/string.h:152:71: note: expected 'const char * restrict' but argument is of type 'char' 152 | extern char *strncat (char *__restrict __dest, const char *__restrict __src, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ main.c:41:12: error: returning 'char *' from a function with return type 'char' makes integer from pointer without a cast [-Wint-conversion] 41 | return restr; | ^~~~~
s751035859
p00429
C
#include<stdio.h> #include<string.h> char StrCount(); main(void){ int num; char str[100]; scanf("%d", &num); scanf("%s", str); for( ; num > 0; num--){ str = StrCount(str); } return 0; } char StrCount(char str[100]){ int i =0, m, cnt = 0; char target,restr[] = ""; target = str[0]; for( m = strlen(str); i <= m; i++){ if( target == str[i]){ cnt++; }else{ if( i == 0){ restr = sprintf(restr, "1%c", str[0]); }else{ restr = sprintf(restr, "%s%c", cnt, str[i-1]); } } } return restr; }
main.c:6:1: error: return type defaults to 'int' [-Wimplicit-int] 6 | main(void){ | ^~~~ main.c: In function 'main': main.c:14:13: error: assignment to expression with array type 14 | str = StrCount(str); | ^ main.c: In function 'StrCount': main.c:30:23: error: assignment to expression with array type 30 | restr = sprintf(restr, "1%c", str[0]); | ^ main.c:32:23: error: assignment to expression with array type 32 | restr = sprintf(restr, "%s%c", cnt, str[i-1]); | ^ main.c:37:12: error: returning 'char *' from a function with return type 'char' makes integer from pointer without a cast [-Wint-conversion] 37 | return restr; | ^~~~~
s941212689
p00429
C++
#include <iostream> #include <string> #include <sstream> using namespace std; typedef stringstream ss; template<class T> inline string toStr(T f){ ss sss; sss << f; return sss.str(); } int main(){ int n; while(cin >> n, n){ string now, prev; cin >> prev; for(int i = 0; i < n; i++){ int cnt; for(int j = 0; j < prev.size(); j+=cnt){ cnt = 0; for(int k = j; prev[k] == prev[j]; k++, cnt++); now.append(toStr(cnt)); now.append(1, prev[j]); } prev = now; now = ""; } cout << prev << endl; }
a.cc: In function 'int main()': a.cc:28:4: error: expected '}' at end of input 28 | } | ^ a.cc:9:11: note: to match this '{' 9 | int main(){ | ^
s883488551
p00429
C++
#include <cstdio> #include <iostream> typedef struct { char number; char num; } NUMBER; NUMBER N[2048]; using namespace std; int main() { char str[2048]; int n; while (cin >> n, n){ cin >> str; memset(N, 0, sizeof(N)); for (int c = 0; c < n; c++){ int i = 0; int j = 0; while (str[i] != '\0'){ if (i > 0 && str[i] == str[i-1]){ N[j-1].num++; } else { N[j].number = str[i]; N[j].num = '1'; j++; } i++; } strcpy(str, ""); for (int i = 0; i < j; i++){ strncat(str, &N[i].number, 1); strncat(str, &N[i].num, 1); } } printf("%s\n", str); } return (0); }
a.cc: In function 'int main()': a.cc:21:17: error: 'memset' was not declared in this scope 21 | memset(N, 0, sizeof(N)); | ^~~~~~ a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <iostream> +++ |+#include <cstring> 3 | a.cc:39:25: error: 'strcpy' was not declared in this scope 39 | strcpy(str, ""); | ^~~~~~ a.cc:39:25: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:42:33: error: 'strncat' was not declared in this scope 42 | strncat(str, &N[i].number, 1); | ^~~~~~~ a.cc:42:33: note: 'strncat' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s068368047
p00429
C++
#include<iostream> #include<string> #include<sstream> using namespace std; int main(){ string str1; int n =0; while(1){ cin >> n; if(n == 0) break; cin >> str1; stringstream ss; char num = str1[0]; for(int i = 0; i< n; i++){ int count = 1; for(int j = 0; j< str1.length(); j++){ if(figure == str[j]) count++; else{ ss << count << num; count = 1; num = str[j]; } } ss <<count<< num; str1 = ss.str(); ss.str(""); } cout << str << endl; } return 0; }
a.cc: In function 'int main()': a.cc:20:12: error: 'figure' was not declared in this scope 20 | if(figure == str[j]) count++; | ^~~~~~ a.cc:20:22: error: 'str' was not declared in this scope; did you mean 'str1'? 20 | if(figure == str[j]) count++; | ^~~ | str1 a.cc:34:13: error: 'str' was not declared in this scope; did you mean 'str1'? 34 | cout << str << endl; | ^~~ | str1
s938657829
p00429
C++
#include<iostream> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:31:41: error: '_itoa_s' was not declared in this scope 31 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s900073746
p00429
C++
#include<iostream> #include<stdlib.h> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:41: error: '_itoa_s' was not declared in this scope 32 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s163282527
p00429
C++
#include<iostream> #include<stdlib.h> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { itoa(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:41: error: 'itoa' was not declared in this scope 32 | itoa(counter2, words2[i], 10); | ^~~~
s330141471
p00429
C++
#include<iostream> #include<stdlib.h> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:32:41: error: '_itoa_s' was not declared in this scope 32 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s568425314
p00429
C++
#include<iostream> #include<stdlib.h> #include <string.h> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:33:41: error: '_itoa_s' was not declared in this scope 33 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s370937582
p00429
C++
#include<iostream> #include<stdlib.h> #include <string.h> using namespace std; char words[21][100000],words2[100000][101],result[100][100000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:33:41: error: '_itoa_s' was not declared in this scope 33 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s375392077
p00429
C++
#include<iostream> using namespace std; char words[21][1000000],words2[1000000][101],result[100][1000000]; int n, counter, counter2; int main() { for (;;) { cin >> n; if (n == 0) { break; } counter++; cin >> words[0]; int i = 0; for (int a = 0; a < n; a++) { for (int b = 0;; b++) { counter2++; if (words[a][b] != words[a][b + 1]) { _itoa_s(counter2, words2[i], 10); words2[i + 1][0] = words[a][b]; i += 2; counter2 = 0; } if (words[a][b] == *"") { int q = 0; counter2 = 0; for (int m = 0; m < i; m++) { int u = 0; while (words2[m][u] != *"") { words[a + 1][q] = words2[m][u]; u++; q++; } } i = 0; break; } } } int r = 0; while (words[n][r] != *"") { result[counter-1][r] = words[n][r]; r++; } } for (int o = 0; o < counter; o++) { cout << result[o] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:31:41: error: '_itoa_s' was not declared in this scope 31 | _itoa_s(counter2, words2[i], 10); | ^~~~~~~
s613101551
p00429
C++
#include<bits/stdc++.h> #define range(i,a,b) for(int i = (a); i < (b); i++) #define rep(i,b) range(i,0,b) #define pb(a) push_back(a) #define all(a) (a).begin(), (a).end() #define debug(x) cout << "debug " << x << endl; using namespace std; string solve(string s){ int count = 1; string r; rep(i,s.size() - 1){ if(s[i] == s[i + 1]){ count++; }else{ r+= cout << count << s[i]; count = 1; } } return s; } int main(){ int n; string s; while(cin >> n,n){ cin >> s; rep(i,n){ s = solve(s); } cout << s << endl; } }
a.cc: In function 'std::string solve(std::string)': a.cc:16:14: error: no match for 'operator+=' (operand types are 'std::string' {aka 'std::__cxx11::basic_string<char>'} and 'std::basic_ostream<char>') 16 | r+= In file included from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from a.cc:1: /usr/include/c++/14/bits/basic_string.h:1424:9: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1424 | operator+=(const _Tp& __svt) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1424:9: note: template argument deduction/substitution failed: In file included from /usr/include/c++/14/bits/stl_pair.h:60, from /usr/include/c++/14/bits/stl_algobase.h:64, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]': /usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = std::basic_ostream<char>; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 149 | using _If_sv = enable_if_t< | ^~~~~~ /usr/include/c++/14/bits/basic_string.h:1424:2: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator+=(const _Tp&) [with _Tp = std::basic_ostream<char>]' 1424 | operator+=(const _Tp& __svt) | ^~~~~~~~ a.cc:17:33: required from here 17 | cout << count << s[i]; | ^ /usr/include/c++/14/type_traits:2711:11: error: no type named 'type' in 'struct std::enable_if<false, std::__cxx11::basic_string<char>&>' 2711 | using enable_if_t = typename enable_if<_Cond, _Tp>::type; | ^~~~~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1377:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1377 | operator+=(const basic_string& __str) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1377:38: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const std::__cxx11::basic_string<char>&' 1377 | operator+=(const basic_string& __str) | ~~~~~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/14/bits/basic_string.h:1387:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(const _CharT*) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1387 | operator+=(const _CharT* __s) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1387:32: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'const char*' 1387 | operator+=(const _CharT* __s) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:1397:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(_CharT) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1397 | operator+=(_CharT __c) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1397:25: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'char' 1397 | operator+=(_CharT __c) | ~~~~~~~^~~ /usr/include/c++/14/bits/basic_string.h:1411:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator+=(std::initializer_list<_Tp>) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' 1411 | operator+=(initializer_list<_CharT> __l) | ^~~~~~~~ /usr/include/c++/14/bits/basic_string.h:1411:43: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'std::initializer_list<char>' 1411 | operator+=(initializer_list<_CharT> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~
s591608655
p00429
C++
#include <iostream> #include <sstream> #include <string> #include <cstdlib> using namespace std; int main() { int n, b = 0, c = 0; string Istr, Ostr; char chi; ostringstream oss; char ch; cin >> n; do { cin >> Istr; while (n--) { for (int i = 0; i < (int)Istr.size();) { ch = Istr[i]; for (int j = i; i < (int)Istr.size(); j++) { if (Istr[i] == Istr[j]) { b++; } else { i = j; break; } } itoa(b, &chi, 10); Ostr.push_back(chi); Ostr.push_back(ch); //oss.clear(); b = 0; //if ((i >= (int)Istr.size()) == true) { // break; //} } Istr.clear(); Istr = Ostr; Ostr.clear(); } cout << Istr << endl; } while (cin >> n); return 0; }
a.cc: In function 'int main()': a.cc:30:33: error: 'itoa' was not declared in this scope 30 | itoa(b, &chi, 10); | ^~~~
s722904652
p00429
C++
#include <iostream> #include <string> using namespace std; template < typename T > std::string to_string(const T& n) { std::ostringstream stm; stm << n; return stm.str(); } int main() { int n, b = 0, c = 0; string Istr, Ostr; char ch; cin >> n; do { cin >> Istr; while (n--) { for (int i = 0; i < (int)Istr.size();) { ch = Istr[i]; for (int j = i; i < (int)Istr.size(); j++) { if (Istr[i] == Istr[j]) { b++; } else { i = j; break; } } Ostr += to_string(b); Ostr.push_back(ch); b = 0; } Istr.clear(); Istr = Ostr; Ostr.clear(); } cout << Istr << endl; cin >> n; } while (n != 0); return 0; }
a.cc: In function 'std::string to_string(const T&)': a.cc:6:28: error: 'stm' has incomplete type 6 | std::ostringstream stm; | ^~~ In file included from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/iosfwd:106:11: note: declaration of 'std::ostringstream' {aka 'class std::__cxx11::basic_ostringstream<char>'} 106 | class basic_ostringstream; | ^~~~~~~~~~~~~~~~~~~
s401462524
p00429
C++
#include <iostream> #include <ostream> #include <string> using namespace std; template < typename T > std::string to_string(const T& n) { std::ostringstream stm; stm << n; return stm.str(); } int main() { int n, b = 0, c = 0; string Istr, Ostr; char ch; cin >> n; do { cin >> Istr; while (n--) { for (int i = 0; i < (int)Istr.size();) { ch = Istr[i]; for (int j = i; i < (int)Istr.size(); j++) { if (Istr[i] == Istr[j]) { b++; } else { i = j; break; } } Ostr += to_string(b); Ostr.push_back(ch); b = 0; } Istr.clear(); Istr = Ostr; Ostr.clear(); } cout << Istr << endl; cin >> n; } while (n != 0); return 0; }
a.cc: In function 'std::string to_string(const T&)': a.cc:7:28: error: 'stm' has incomplete type 7 | std::ostringstream stm; | ^~~ In file included from /usr/include/c++/14/ios:40, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/c++/14/iosfwd:106:11: note: declaration of 'std::ostringstream' {aka 'class std::__cxx11::basic_ostringstream<char>'} 106 | class basic_ostringstream; | ^~~~~~~~~~~~~~~~~~~
s457568462
p00429
C++
#include <iostream> #include <ostringstream> #include <string> using namespace std; template < typename T > std::string to_string(const T& n) { std::ostringstream stm; stm << n; return stm.str(); } int main() { int n, b = 0, c = 0; string Istr, Ostr; char ch; cin >> n; do { cin >> Istr; while (n--) { for (int i = 0; i < (int)Istr.size();) { ch = Istr[i]; for (int j = i; i < (int)Istr.size(); j++) { if (Istr[i] == Istr[j]) { b++; } else { i = j; break; } } Ostr += to_string(b); Ostr.push_back(ch); b = 0; } Istr.clear(); Istr = Ostr; Ostr.clear(); } cout << Istr << endl; cin >> n; } while (n != 0); return 0; }
a.cc:2:10: fatal error: ostringstream: No such file or directory 2 | #include <ostringstream> | ^~~~~~~~~~~~~~~ compilation terminated.
s125998271
p00429
C++
#include <iostream> #include <fstream> #include <cstdlib> #include <vector> using namespace std; vector<int> func(vector<int> s); int main(){ ifstream in("input.txt"); int n; vector<int> s; in >> n; char c; while(in>>c){ s.push_back(atoi(c)); } for(int i=0; i<n; i++){ s = func(s); } ofstream out("output.txt"); for(i=0; i<s.size(); i++){ out << s[i]; } out<<endl; return 0; } vector<int> func(vector<int> s){ int sindex=1; int count=1, p=s[0]; vector<int> a; while(1){ if(sindex==s.size()-1){ a.push_back(count); a.push_back(p); break; } if(s[sindex-1]==s[sindex]){ count+=1; sindex+=1; continue; } if(s[sindex-1]!=s[sindex]){ a.push_back(count); a.push_back(p); count=1; p=s[sindex]; sindex+=1; continue; } } return a; }
a.cc: In function 'int main()': a.cc:14:26: error: invalid conversion from 'char' to 'const char*' [-fpermissive] 14 | s.push_back(atoi(c)); | ^ | | | char In file included from /usr/include/c++/14/cstdlib:79, from /usr/include/c++/14/ext/string_conversions.h:43, from /usr/include/c++/14/bits/basic_string.h:4154, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bits/locale_classes.h:40, from /usr/include/c++/14/bits/ios_base.h:41, from /usr/include/c++/14/ios:44, from /usr/include/c++/14/ostream:40, from /usr/include/c++/14/iostream:41, from a.cc:1: /usr/include/stdlib.h:105:30: note: initializing argument 1 of 'int atoi(const char*)' 105 | extern int atoi (const char *__nptr) | ~~~~~~~~~~~~^~~~~~ a.cc:21:9: error: 'i' was not declared in this scope 21 | for(i=0; i<s.size(); i++){ | ^
s403694012
p00429
C++
#include "stdafx.h" #include<iostream> #include<string> using namespace std; int main() { int n; string s; while (cin >> n, n) { cin >> s; for (int x = 0;x < n;x++) { s += '@'; string sg=""; char now = s[0]; int ko = 0; for (int i = 0;i < s.size();i++) { if (s[i] == now)ko++; else { string sa = to_string(ko); sg += sa; sg.push_back(now); now = s[i]; ko = 1; } } s = sg; } cout << s << endl; } return 0; }
a.cc:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s344983316
p00429
C++
#include<iostream> #include<deque> int n; int ToStr(int str[]); int str_max; using namespace std; int main() { char str[101]; int i; int str_int[101]; for(;;){ cin >> n; if(n == 0){ break; } cin >> str; for(i = 0; str[i] != '\0'; i++){ str_int[i] = (char)str[i]; } for(i = 0; str[i] != '\0'; i++){ str_int[i] -= 48; } str_int[i] = 0; str_max = strlen(str); ToStr(&str_int[0]); } } int ToStr(int str[]) { int temp, i; int cont, cont2 = 0; int data[50][2]; deque<int> str2(1, 0); for(i = 0;; i++){ cont = 1; temp = str[i]; if(temp == 0){ break; } for(;;){ if(temp != str[i+1]){ break; } else{ cont++; i++; } } // cout << temp <<"ツつェ" << cont << "ツ嘉ア" << endl; data[cont2][0] = cont; data[cont2][1] = temp; // printf(" data[%d][0]:%d", cont2,data[cont2][0]); // printf(" data[%d][1]:%d\n", cont2,data[cont2][1]); cont2++; } temp = cont2; for(; cont2 > 0; cont2--){ str2.push_front(data[cont2-1][1]); str2.push_front(data[cont2-1][0]); } // cout << endl; // cout << "/***********ツ終ツ猟ケ**************/" << endl; if(n == 1){ for(i = 0; i < temp * 2; i++){ cout << str2[i] ; } cout << endl; return 0; } else{ n--; return ToStr(&str2[0]); } }
a.cc: In function 'int main()': a.cc:29:19: error: 'strlen' was not declared in this scope 29 | str_max = strlen(str); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<deque> +++ |+#include <cstring> 3 |
s850555960
p00429
C++
/* ƒvƒƒOƒ‰ƒ€’†‚Ì–³‘Ê‚Ècout‚͏Á‚µ‚Ü‚µ‚傤 */ #include<iostream> #include<deque> #include<string.h> #include<windows.h> int n; int ToStr(int str[]); int str_max; using namespace std; int main() { char str[101]; int i; int str_int[101]; for(;;){ cin >> n; if(n == 0){ break; } cin >> str; for(i = 0; str[i] != '\0'; i++){ str_int[i] = (char)str[i]; } for(i = 0; str[i] != '\0'; i++){ str_int[i] -= 48; } str_int[i] = -1; str_max = strlen(str); ToStr(&str_int[0]); } } int ToStr(int str[]) { int temp, i; int cont, cont2 = 0; int data[101][2]; deque<int> str2; for(i = 0;; i++){ cont = 1; temp = str[i]; if(temp == -1){ break; } for(;;){ if(temp != str[i+1]){ break; } else{ cont++; i++; } // cout << "*" << endl; } // cout << temp <<"‚ª" << cont << "‰ñ" << endl; data[cont2][0] = cont; data[cont2][1] = temp; // printf(" data[%d][0]:%d", cont2,data[cont2][0]); // printf(" data[%d][1]:%d\n", cont2,data[cont2][1]); cont2++; } temp = cont2; for(; cont2 > 0; cont2--){ str2.push_front(data[cont2-1][1]); str2.push_front(data[cont2-1][0]); } // cout << "/***********I—¹**************/" << endl; // Sleep(10000); if(n == 1){ for(i = 0; i < temp * 2; i++){ cout << str2[i]; } cout << endl; return 0; } else{ n--; str2.push_back(-1); // cout << "*"; for(i = 0; i < temp * 2; i++){ // cout << str2[i]; } // cout << endl; return ToStr(&str2[0]); } }
a.cc:8:9: fatal error: windows.h: No such file or directory 8 | #include<windows.h> | ^~~~~~~~~~~ compilation terminated.
s325949664
p00429
C++
char s[65536],t[65536]; int n,i,r,w,c,a; int main() { while(scanf("%d",&n),n){ scanf("%s",s); for(i=0;i<n;++i){ r=w=0; while(r<strlen(s)){ a=s[r]; for(c=0;s[r+c]==a;++c); sprintf(t+w,"%d\0",c); while(t[++w]); t[w++]=a; r+=c; } t[w]=0; strcpy(s,t); } puts(s); } exit(0); }
a.cc: In function 'int main()': a.cc:5:15: error: 'scanf' was not declared in this scope 5 | while(scanf("%d",&n),n){ | ^~~~~ a.cc:9:33: error: 'strlen' was not declared in this scope 9 | while(r<strlen(s)){ | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | char s[65536],t[65536]; a.cc:12:33: error: 'sprintf' was not declared in this scope 12 | sprintf(t+w,"%d\0",c); | ^~~~~~~ a.cc:1:1: note: 'sprintf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>' +++ |+#include <cstdio> 1 | char s[65536],t[65536]; a.cc:18:25: error: 'strcpy' was not declared in this scope 18 | strcpy(s,t); | ^~~~~~ a.cc:18:25: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:20:17: error: 'puts' was not declared in this scope 20 | puts(s); | ^~~~ a.cc:22:9: error: 'exit' was not declared in this scope 22 | exit(0); | ^~~~ a.cc:1:1: note: 'exit' is defined in header '<cstdlib>'; this is probably fixable by adding '#include <cstdlib>' +++ |+#include <cstdlib> 1 | char s[65536],t[65536];
s679922652
p00429
C++
char s[65536],t[65536];main(n,i,r,w,c){for(;scanf("%d",&n),n;puts(s))for(i=!scanf("%s",s);i++<n;t[w]=0,strcpy(s,t))for(r=w=0;r<strlen(s);t[w++]=s[r],r+=c){for(c=0;s[++c+r]==s[r];);for(sprintf(t+w,"%d\0",c);t[++w];);}}
a.cc:1:28: error: expected constructor, destructor, or type conversion before '(' token 1 | char s[65536],t[65536];main(n,i,r,w,c){for(;scanf("%d",&n),n;puts(s))for(i=!scanf("%s",s);i++<n;t[w]=0,strcpy(s,t))for(r=w=0;r<strlen(s);t[w++]=s[r],r+=c){for(c=0;s[++c+r]==s[r];);for(sprintf(t+w,"%d\0",c);t[++w];);}} | ^
s657514132
p00429
C++
#include<cstdio> #include<iostream> #include<string> #include<cstring> #include<sstream> using namespace std; int main(){ int n,num,cont,v; string a,nex; stringstream ss; char a[100]; while(1){ scanf("%d",&n); if(n==0){break;} cin>>a; for(int i=0;i<n;i++){ cont=0; while(1){ if(cont>=a.size()){break;} num=a[cont]; v=0; while(1){ if(a[cont]!=num){break;} v++; cont++; } /* ss.str(""); ss<<v;*/ sprintf(a,"%d",v); nex+=a; //nex+=ss.str(); nex+=num; } a=nex; nex=""; } cout<<a<<endl; } }
a.cc: In function 'int main()': a.cc:13:38: error: conflicting declaration 'char a [100]' 13 | char a[100]; | ^ a.cc:11:24: note: previous declaration as 'std::string a' 11 | string a,nex; | ^ a.cc:38:41: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'char*' 38 | sprintf(a,"%d",v); | ^ | | | std::string {aka std::__cxx11::basic_string<char>} In file included from /usr/include/c++/14/cstdio:42, from a.cc:1: /usr/include/stdio.h:365:38: note: initializing argument 1 of 'int sprintf(char*, const char*, ...)' 365 | extern int sprintf (char *__restrict __s, | ~~~~~~~~~~~~~~~~~^~~
s782012216
p00429
C++
#include<cstdio> #include<iostream> #include<string> #include<cstring> #include<sstream> #include<cstdlib> using namespace std; int main(){ int n,num,cont,v; string a,nex; stringstream ss; char bin[100]; while(1){ scanf("%d",&n); if(n==0){break;} cin>>a; for(int i=0;i<n;i++){ cont=0; while(1){ if(cont>=a.size()){break;} num=a[cont]; v=0; while(1){ if(a[cont]!=num){break;} v++; cont++; } /* ss.str(""); ss<<v;*/ itoa(v,bin,10); nex+=bin; //nex+=ss.str(); nex+=num; } a=nex; nex=""; } cout<<a<<endl; } }
a.cc: In function 'int main()': a.cc:39:33: error: 'itoa' was not declared in this scope 39 | itoa(v,bin,10); | ^~~~
s385416119
p00429
C++
#include<iostream> using namespace std; const unsigned int N = 10000000; char s[N]; int n; void erace(){ for(int i=0; i<N; i++) if(s[i]=='\0') break; s[i] = '\0'; } void copy(char *a){ for(int i=0; i<N; i++){ a[i] = s[i]; if(s[i]=='\0') break; } } void solve(){ if(n==0) return; char a[N]; copy(a); erace(); n--; int tmp=0,count=1; char temp=a[0]; for(int i=1; a[i]!='\0'; i++){ if(temp == a[i]) count++; else{ s[tmp] = static_cast<char>(count+48); for(;;tmp++){ if(s[tmp] == '\0') break; } s[tmp] = temp; temp = a[i]; count = 1; tmp++; } } s[tmp] = static_cast<char>(count+48); for(;;tmp++){ if(s[tmp] == '\0') break; } s[tmp] = temp; solve(); } int main(){ while(true){ cin >> n; if(!n) return 0; erace(); cin >> s; solve(); cout << s << endl; } }
a.cc: In function 'void erace()': a.cc:12:19: error: 'i' was not declared in this scope 12 | s[i] = '\0'; | ^
s292918618
p00429
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int f(string); int main() { int n; string str; for(;;){ cin>>n; if(n == 0) break; cin>>str; for(int i = 0; i < n; i++){ string ans; for(int j = 0; j < str.size();){ char buf[1024]; int len = f(str.substr(j)); sprintf_s(buf, "%d%c", len, str.at(j)); ans += buf; j += len; } str = ans; } cout<<str<<endl; } } // sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ // sst ツづ按づァツ return 2 int f(string s) { int count; for(count = 1; count < s.size(); count++){ if(s.at(count-1) != s.at(count)) break; } return count; }
a.cc: In function 'int main()': a.cc:20:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 20 | sprintf_s(buf, "%d%c", len, str.at(j)); | ^~~~~~~~~ | sprintf
s817982396
p00429
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int f(string); int main() { int n; string str; for(;;){ cin>>n; if(n == 0) break; cin>>str; for(int i = 0; i < n; i++){ string ans; for(unsigned int j = 0; j < str.size();){ char buf[1024]; int len = f(str.substr(j)); sprintf_s(buf, "%d%c", len, str.at(j)); ans += buf; j += len; } str = ans; } cout<<str<<endl; } } // sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ // sst ツづ按づァツ return 2 int f(string s) { unsigned int count; for(count = 1; count < s.size(); count++){ if(s.at(count-1) != s.at(count)) break; } return count; }
a.cc: In function 'int main()': a.cc:20:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 20 | sprintf_s(buf, "%d%c", len, str.at(j)); | ^~~~~~~~~ | sprintf
s700601002
p00429
C++
#include <iostream> #include <algorithm> #include <string> using namespace std; int f(string); int main() { int n; string str; for(;;){ cin>>n; if(n == 0) break; cin>>str; for(int i = 0; i < n; i++){ string ans; for(unsigned int j = 0; j < str.size();){ char buf[1024]; int len = f(str.substr(j)); sprintf_s(buf, 1024, "%d%c", len, str.at(j)); ans += buf; j += len; } str = ans; } cout<<str<<endl; } } // sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ // sst ツづ按づァツ return 2 int f(string s) { unsigned int count; for(count = 1; count < s.size(); count++){ if(s.at(count-1) != s.at(count)) break; } return count; }
a.cc: In function 'int main()': a.cc:20:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 20 | sprintf_s(buf, 1024, "%d%c", len, str.at(j)); | ^~~~~~~~~ | sprintf
s564130777
p00429
C++
#include <iostream> #include <string> using namespace std; // sツづ個静ヲツ督ェツつゥツづァツづ個連ツ堕アツ青板づーツ陛板つキ // sst ツづ按づァツ return 2 int f(string s) { unsigned int count; for(count = 1; count < s.size(); count++){ if(s.at(count-1) != s.at(count)) break; } return count; } int main() { int n; string str; while(1){ cin>>n; if(n == 0) break; cin>>str; for(int i = 0; i < n; i++){ string ans; for(unsigned int j = 0; j < str.size();){ char buf[1024]; int len = f(str.substr(j)); sprintf_s(buf, 1024, "%d%c", len, str.at(j)); ans += buf; j += len; } str = ans; } cout<<str<<endl; } }
a.cc: In function 'int main()': a.cc:28:33: error: 'sprintf_s' was not declared in this scope; did you mean 'sprintf'? 28 | sprintf_s(buf, 1024, "%d%c", len, str.at(j)); | ^~~~~~~~~ | sprintf