submission_id
stringlengths
10
10
problem_id
stringlengths
6
6
language
stringclasses
3 values
code
stringlengths
1
522k
compiler_output
stringlengths
43
10.2k
s461931285
p00015
C++
import java.util.Scanner; import java.math.BigInteger; public class a0015{ public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int N = scanner.nextInt(); for (int i = 0; i < N; i++) { String a = scanner.next(), b = scanner.next(); BigInteger A = new BigInteger(a), B = new BigInteger(b); BigInteger sum = A.add(B); if ((sum.toString()).length() > 80) { System.out.println("overflow"); } else { System.out.println(sum.toString()); } } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.util.Scanner; | ^~~~~~ 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:4:1: error: expected unqualified-id before 'public' 4 | public class a0015{ | ^~~~~~
s669012606
p00015
C++
#include<iostream> #include<string> typedef unsigned int u; using namespace std; typedef string::iterator s; u z=100000000; void p(u*a,u*l,u n){ if(a-l) p(a+1,l,(n+=*a*10)/z), *a=n%z; } u t(u*a,u*l){ u r=0; char b[11]={}; if(a-l) if(!t(a+1,l)){ if(*a)cout<<*a,r=1; }else sprintf(b,"%d",*a+z), cout<<b+1, r=1; return r; } void d(u*a,u*l,u*b,u n=0){ if(a-l) d(a+1,l,b+1,(n+=(*a+*b))/z), *a=n%z; } u main(){ u n; cin>>n; string a,b; getline(cin,a); for(;n--;){ getline(cin,a); getline(cin,b); u x[11]={},y[11]={},c=0; for(s i=a.begin();i!=a.end();p(x,x+10,*i++-48)) if(++c>80)goto g; c=0; for(s i=b.begin();i!=b.end();p(y,y+10,*i++-48)) if(++c>80)goto g; d(x,x+11,y); if(x[10])goto g; else if(!t(x,x+10))cout<<'0'; if(0) g: cout<<"overflow"; cout<<'\n'; } }
a.cc:29:1: error: '::main' must return 'int' 29 | u main(){ | ^
s526977585
p00015
C++
#include<iostream> #include<string> typedef unsigned int u; using namespace std; typedef string::iterator s; u z=100000000; void p(u*a,u*l,u n){ if(a-l) p(a+1,l,(n+=*a*10)/z), *a=n%z; } u t(u*a,u*l){ u r=0; char b[11]={}; if(a-l) if(!t(a+1,l)){ if(*a)cout<<*a,r=1; }else sprintf(b,"%d",*a+z), cout<<b+1, r=1; return r; } void d(u*a,u*l,u*b,u n=0){ if(a-l) d(a+1,l,b+1,(n+=(*a+*b))/z), *a=n%z; } u main(){ u n; cin>>n; string a,b; getline(cin,a); for(;n--;){ getline(cin,a); getline(cin,b); u x[11]={},y[11]={},c=0; for(s i=a.begin();i!=a.end();p(x,x+10,*i++-48)) if(++c>80)goto g; c=0; for(s i=b.begin();i!=b.end();p(y,y+10,*i++-48)) if(++c>80)goto g; d(x,x+11,y); if(x[10])goto g; else if(!t(x,x+10))cout<<'0'; goto e; g: cout<<"overflow"; e: cout<<'\n'; } }
a.cc:29:1: error: '::main' must return 'int' 29 | u main(){ | ^
s248424360
p00015
C++
#include <stdio.h> int main(void) { char a[81],b[81],result[81],temp[81]; int ketaagari; int i,j; int max; char in; int overflow; int count,kazu; scanf("%d",&kazu); while(getchar()!='\n'); for(count=0;count<kazu;count++) { for(i=0;i<81;i++) { a[i]=0;b[i]=0; } i=0; overflow=0; scanf(" %s ",temp); i=strlen(temp); //puts(temp); if(overflow==0) { for(j=0;j<i;j++)a[j]=temp[i-j-1]-'0'; } i=0; //printf("a %s\n",a); scanf(" %s ",temp); i=strlen(temp); if(overflow==0) { for(j=0;j<i;j++)b[j]=temp[i-j-1]-'0'; //printf("b %s\n",b); for(i=0,ketaagari=0,max=0;i<80;i++) { result[i]=(a[i]+b[i]+ketaagari)%10; ketaagari=(a[i]+b[i]+ketaagari)/10; if(result[i]!=0)max=i; } if(ketaagari)overflow=1; } if(overflow==0) { for(i=max;i>=0;i--)printf("%d",result[i]); printf("\n"); } else printf("overflow\n"); } return 0; }
a.cc: In function 'int main()': a.cc:22:11: error: 'strlen' was not declared in this scope 22 | i=strlen(temp); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <stdio.h> +++ |+#include <cstring> 2 |
s871598635
p00015
C++
import java.io.*; import java.util.*; import java.math.*; class Main{ public static void main(String args[]) throws IOException{ ArrayList<String> inp = new ArrayList<String>(); Scanner scan = new Scanner(System.in); String str1 = scan.next(); BigInteger big_inp; String str_c; int n = Integer.valueOf(str1).intValue(); while(scan.hasNext()){ str1 = scan.next(); if(str1.length() > 80){System.out.println("overflow");} inp.add(str1); } BigInteger big_sum; for(int i=0;i<inp.size()/n;i++){ big_sum = new BigInteger("0"); for(int j=0;j<n;j++){ big_inp = new BigInteger(inp.get(i*n+j)); big_sum = big_sum.add(big_inp); } str_c = big_sum.toString(); if(str_c.length() > 80)System.out.println("overflow"); else System.out.println(big_sum); } } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.*; | ^~~~~~ 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.util.*; | ^~~~~~ 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:6:23: error: expected ':' before 'static' 6 | public static void main(String args[]) throws IOException{ | ^~~~~~~ | : a.cc:6:41: error: 'String' has not been declared 6 | public static void main(String args[]) throws IOException{ | ^~~~~~ a.cc:6:54: error: expected ';' at end of member declaration 6 | public static void main(String args[]) throws IOException{ | ^ | ; a.cc:6:56: error: 'throws' does not name a type 6 | public static void main(String args[]) throws IOException{ | ^~~~~~ a.cc:36:2: error: expected ';' after class definition 36 | } | ^ | ;
s644784991
p00015
C++
#include <cstdio> #include <string> using namespace std; int main(void) { int n; bool flag; scanf("%d", &n); while (n != 0){ flag = true; int num1[81] = {0}, num2[81] = {0}; int max_len; char in[3000]; scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ int len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num1[j] = in[i] - '0'; j++; } } scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { if (max_len < len) max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num2[j] = in[i] - '0'; j++; } } // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¶‚á‚È‚¢‚Æ‚«‚ɉ‰ŽZ if (flag){ for (int i = 0; i < 80; i++){ num1[i] += num2[i]; if (10 <= num1[i]){ num1[i + 1] += 1; num1[i] %= 10; } } if (num1[80] != 0){ flag = 0; // 81Œ…–Ú‚ª0‚¶‚á‚È‚¢ = overflow } // overflow‚µ‚ĂȂ¢‚Æ‚«‚ɏo—Í if (flag == 1){ // ÅŒã‚Ì‘«‚µã‚°‚ÅŒJ‚èã‚ª‚肵‚Ă邩‚Ç‚¤‚© if (num1[max_len] == 0){ for (int i = max_len - 1; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } else { for (int i = max_len; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } } } // ¡‚܂łÉflag‚ª0‚ɂȂÁ‚Ä‚½‚çoverflowI if (flag == 0){ printf("overflow\n"); } n--; } }
a.cc: In function 'int main()': a.cc:20:24: error: 'strlen' was not declared in this scope 20 | int len = (int)strlen(in); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string> +++ |+#include <cstring> 3 | using namespace std;
s285710471
p00015
C++
#include <cstdio> #include <string> using namespace std; int main(void) { int n; bool flag; scanf("%d", &n); while (n != 0){ flag = true; int num1[81] = {0}; int num2[81] = {0}; int max_len; char in[3000]; scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ int len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num1[j] = in[i] - '0'; j++; } } scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { if (max_len < len) max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num2[j] = in[i] - '0'; j++; } } // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¶‚á‚È‚¢‚Æ‚«‚ɉ‰ŽZ if (flag){ for (int i = 0; i < 80; i++){ num1[i] += num2[i]; if (10 <= num1[i]){ num1[i + 1] += 1; num1[i] %= 10; } } if (num1[80] != 0){ flag = 0; // 81Œ…–Ú‚ª0‚¶‚á‚È‚¢ = overflow } // overflow‚µ‚ĂȂ¢‚Æ‚«‚ɏo—Í if (flag){ // ÅŒã‚Ì‘«‚µã‚°‚ÅŒJ‚èã‚ª‚肵‚Ă邩‚Ç‚¤‚© if (num1[max_len] == 0){ for (int i = max_len - 1; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } else { for (int i = max_len; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } } } // ¡‚܂łÉflag‚ª0‚ɂȂÁ‚Ä‚½‚çoverflowI if (!flag){ printf("overflow\n"); } n--; } }
a.cc: In function 'int main()': a.cc:21:24: error: 'strlen' was not declared in this scope 21 | int len = (int)strlen(in); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string> +++ |+#include <cstring> 3 | using namespace std;
s371778490
p00015
C++
#include <cstdio> #include <string> using namespace std; int main(void) { int n; bool flag; scanf("%d", &n); while (n != 0){ flag = true; int num1[81] = {0}; int num2[81] = {0}; int max_len; char in[3000]; scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ int len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num1[j] = in[i] - '0'; j++; } } scanf("%s", in); // ˆê’U’l‚ðŽæ‚èž‚Þ len = (int)strlen(in); if (80 < len) flag = false; // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¾‚Á‚½‚çAflag‚ð0‚É‚·‚é else { if (max_len < len) max_len = len; int j = 0; for (int i = (len - 1); -1 < i; i--){ num2[j] = in[i] - '0'; j++; } } // “ü‚Á‚½’l‚ª80Œ…ˆÈã‚¶‚á‚È‚¢‚Æ‚«‚ɉ‰ŽZ if (flag == true){ for (int i = 0; i < 80; i++){ num1[i] += num2[i]; if (10 <= num1[i]){ num1[i + 1] += 1; num1[i] %= 10; } } if (num1[80] != 0){ flag = false; // 81Œ…–Ú‚ª0‚¶‚á‚È‚¢ = overflow } // overflow‚µ‚ĂȂ¢‚Æ‚«‚ɏo—Í if (flag == true){ // ÅŒã‚Ì‘«‚µã‚°‚ÅŒJ‚èã‚ª‚肵‚Ă邩‚Ç‚¤‚© if (num1[max_len] == 0){ for (int i = max_len - 1; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } else { for (int i = max_len; -1 < i; i--){ printf("%d", num1[i]); } printf("\n"); } } } // ¡‚܂łÉflag‚ª0‚ɂȂÁ‚Ä‚½‚çoverflowI if (flag == false){ printf("overflow\n"); } n--; } }
a.cc: In function 'int main()': a.cc:21:24: error: 'strlen' was not declared in this scope 21 | int len = (int)strlen(in); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include <string> +++ |+#include <cstring> 3 | using namespace std;
s250348019
p00015
C++
import java.io.BufferedReader; import java.io.InputStreamReader; //‚©‚Ȃ艘‚¢Bƒ‹[ƒv‚ɍH•v‚Ì—]’n‚ ‚è //public class Problem0015_NationalBudget { public class Main { public static void main(String[] args) { try { // Problem0015_NationalBudget test = new Problem0015_NationalBudget(); Main test = new Main(); BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int problemNumber = Integer.parseInt(reader.readLine()); for(int i = 0; i < problemNumber; i++) { String origin = reader.readLine(); String addition = reader.readLine(); String result = test.getSum(origin, addition); if(result == null) { System.out.println("overflow"); } else { System.out.println(result); } } } catch(Exception e) { e.printStackTrace(); } /* Problem0015_NationalBudget test = new Problem0015_NationalBudget(); for(int i = 0; i < 11; i++) { for(int j = 0; j < 11; j++) { String answer = test.getSum(Integer.toString(i), Integer.toString(j)); if(i+j < 10) { if(answer.equals(Integer.toString(i+j))) { System.out.println(i + " + " + j + " = " + answer); } else { System.err.println(i + " + " + j + " = " + answer); } } else { if(answer == null) { System.out.println(i + " + " + j + " = " + "overflow"); } else { System.err.println(i + " + " + j + " = " + answer); } } } } */ } String getSum(String origin, String addition) { final int CEILLING = 79; char[] originArray = origin.toCharArray(); char[] additionArray = addition.toCharArray(); char[] maxCharArray = (originArray.length < additionArray.length ? additionArray : originArray); char[] minCharArray = (originArray.length < additionArray.length ? originArray : additionArray); if(maxCharArray.length > CEILLING) { //overflow ‚̂Ƃ«‚Í null ‚ð•Ô‚·B return null; } int[] resultNumberArray = new int[maxCharArray.length + 1]; //Œ…‚ª‚P‚オ‚é‰Â”\«‚ª‚ ‚éB int position; for(position = 1; position < minCharArray.length +1; position++) { int originNumber = Integer.parseInt("" + maxCharArray[maxCharArray.length - position]); int additionNumber = Integer.parseInt("" +minCharArray[minCharArray.length - position]); int sum = originNumber + additionNumber + resultNumberArray[resultNumberArray.length-position]; // System.out.println(maxCharArray[maxCharArray.length - position] + " + " + minCharArray[minCharArray.length - position] + " = " + sum); if(sum < 10) { resultNumberArray[resultNumberArray.length-position] = sum; } else { //0<= sum < 19 ‚æ‚èŒJ‚èã‚ª‚肪"1"”­¶ sum = sum - 10; resultNumberArray[resultNumberArray.length-position] = sum; resultNumberArray[resultNumberArray.length-position -1] += 1; } } for(; position < maxCharArray.length + 1; position++) { int maxCharNumber = Integer.parseInt("" + maxCharArray[position - position]); int sum = resultNumberArray[resultNumberArray.length-position] + maxCharNumber; if(sum < 10) { resultNumberArray[resultNumberArray.length-position] = sum; } else { sum = sum - 10; resultNumberArray[resultNumberArray.length-position] = sum; resultNumberArray[resultNumberArray.length-position -1] += 1; } } if(resultNumberArray.length > CEILLING+1 ||(resultNumberArray.length == CEILLING+1 && resultNumberArray[0] > 0)) { //Œ…‚ªã‚ª‚Á‚Ä80‚ð’´‚¦‚½ê‡ return null; } StringBuilder textBuilder = new StringBuilder(); for(int number : resultNumberArray) { textBuilder.append(Integer.toString(number)); } String result = textBuilder.toString(); if(result.startsWith("0")) { result = result.substring(1); } return result; } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.BufferedReader; | ^~~~~~ 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.io.InputStreamReader; | ^~~~~~ a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:6:1: error: expected unqualified-id before 'public' 6 | public class Main { | ^~~~~~
s023759343
p00015
C++
#include <iostream> #include <algorithm> using namespace std; void tasu(string s1, string s2){ int num[2][max(s1.length(), s2.length())+1]; for(int i = 0; i < sizeof(num[0])/sizeof(int); i++){ if(s1.length() > i){ num[0][i] = (int)s1.at(s1.length()-1-i) - (int)'0'; }else{ num[0][i] = 0; } if(s2.length() > i){ num[1][i] = (int)s2.at(s2.length()-1-i) - (int)'0'; }else{ num[1][i] = 0; } } for(int i = 0; i < sizeof(num[0])/sizeof(int)-1; i++){ num[1][i] += num[0][i]; if(num[1][i] > 9){ num[1][i+1] += (int)(num[1][i]/10); num[1][i] %= 10; } } int keta = sizeof(num[0])/sizeof(int); while(keta && !num[1][keta-1]){ keta--; } if(keta => 80){ cout << "overflow" << endl; }else{ while(keta--){ cout << num[1][keta]; } cout << endl; } } int main(){ int n; cin >> n; while(n--){ string s1, s2; cin >> s1 >> s2; tasu(s1, s2); } }
a.cc: In function 'void tasu(std::string, std::string)': a.cc:31:18: error: expected primary-expression before '>' token 31 | if(keta => 80){ | ^
s434794032
p00015
C++
import java.io.PrintWriter; import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); BigInteger a, b; int N = Integer.parseInt(input.nextLine()); while(N > 0) { a = new BigInteger(input.nextLine()); b = new BigInteger(input.nextLine()); a = a.add(b); if(a.toString().length() > 80) { out.println("overflow"); } else { out.println(a.toString()); } N--; } input.close(); out.close(); } }
a.cc:1:1: error: 'import' does not name a type 1 | import java.io.PrintWriter; | ^~~~~~ 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.Scanner; | ^~~~~~ a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts' a.cc:5:1: error: expected unqualified-id before 'public' 5 | public class Main { | ^~~~~~
s896575518
p00015
C++
#include <iostream> #include <sstream> #include <cmath> #include <algorithm> #include <queue> #include <stack> using namespace std; int main() { int t; scanf("%d",&t); for(int i=0;i<t;i++){ string a; string b; cin >> a; cin >> b; string res; reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); int carry = 0; int idx; for(int j=0;j<min(a.size(),b.size());j++){ int lhs = a[j] - '0'; int rhs = b[j] - '0'; res.push_back((carry + lhs + rhs) % 10 + '0'); carry = (carry + lhs + rhs) / 10 ? 1 : 0; idx =j; } for(int j=idx+1;j<max(a.size(),b.size());j++){ if(a.size() > b.size()){ int lhs = a[j] - '0'; res.push_back((carry + lhs) % 10 + '0'); carry = (carry + lhs) / 10 ? 1 : 0; } else{ int rhs = b[j] - '0'; res.push_back((carry + rhs) % 10 + '0'); carry = (carry + rhs) / 10 ? 1 : 0; } } carry ? res.push_back(carry+'0') : ""; reverse(res.begin(),res.end()); cout << res << endl; } }
a.cc: In function 'int main()': a.cc:46:52: error: second operand to the conditional operator is of type 'void', but the third operand is neither a throw-expression nor of type 'void' 46 | carry ? res.push_back(carry+'0') : ""; | ^~
s202692518
p00015
C++
#include <iostream> #include <cstdio> #include <algorithm> using namespace std; int main(){ int n, maxlen; char a[101], b[101]; cin >> n; for(int ii = 0 ; ii < n ; ii++){ string ans = ""; scanf("%s%s", a, b); maxlen = max(strlen(a), strlen(b)); reverse(a, a+strlen(a)); reverse(b, b+strlen(b)); for(int i = strlen(a) ; i < 100 ; i++){ a[i] = '0'; } for(int i = strlen(b) ; i < 100 ; i++){ b[i] = '0'; } int tmp, tmp2 = 0; bool flag = 0; for(int i = 0 ; i < maxlen ; i++){ tmp = (a[i] - '0') + (b[i] - '0') + tmp2; if(i == maxlen - 1){ if(tmp >= 10){ tmp2 = 1; tmp -= 10; ans += tmp + '0'; ans += '1'; } else ans += tmp + '0'; } else if(tmp >= 10){ tmp2 = 1; tmp -= 10; ans += tmp + '0'; } else if(tmp <= 9){ ans += tmp + '0'; tmp2 = 0; } } reverse(ans.begin(), ans.end()); int size = ans.size(); if(size >= 80 || maxlen >= 80) cout << "overflow" << endl; else cout << ans << endl; } return 0; }
a.cc: In function 'int main()': a.cc:14:18: error: 'strlen' was not declared in this scope 14 | maxlen = max(strlen(a), strlen(b)); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <algorithm> +++ |+#include <cstring> 4 | using namespace std;
s367519268
p00015
C++
#include<vector> #include<iostream> #include<iomanip> #include<string> #include<cstdlib> typedef std::vector<int> bignum; const int e9=1000000000; bignum plus(const bignum& a,const bignum& b); bignum minus(const bignum& a,const bignum& b); void input(bignum& num); void output(const bignum& num); int compare(const bignum& a,const bignum& b); bignum newnum(const std::string& str); int main() { bignum a,b,sum; int n; cin>>n; for(i=0;i<n;i++) { input(a); input(b); sum=plus(a,b); if(compare(sum,newnum("10000000000000000000000000000000000000000000000000000000000000000000000000000000"))>0) { std::cout<<"overflow"<<std::endl; } else { output(sum); } } } bignum plus(const bignum& a,const bignum& b) { bignum sum; int carry=0; long long temp; for(int i=0;i<((a.size()>b.size())?a.size():b.size())||carry==1;i++) { temp=carry; carry=0; if(i<a.size()) { temp+=a[i]; } if(i<b.size()) { temp+=b[i]; } sum.push_back(temp%e9); if(temp>=e9) { carry=1; } } return sum; } int compare(const bignum& a,const bignum& b) { if(a.size()>b.size()){return 1;} else if(a.size()<b.size()){return -1;} else { for(int i=a.size()-1;i>=0;i--) { if(a[i]>b[i]){return 1;} else if(a[i]<b[i]){return -1;} } } return 0; } bignum newnum(const std::string& str) { bignum num; int len; for(int i=str.size();i>=0;i-=9) { len=9; if(i<9)len=i; num.push_back(atoi(str.substr(i-len,len).c_str())); } return num; } void input(bignum& num) { std::string str; int len; std::cin>>str; for(int i=str.size();i>=0;i-=9) { len=9; if(i<9)len=i; num.push_back(atoi(str.substr(i-len,len).c_str())); } } void output(const bignum& num) { for(int i=num.size()-1;i>=0;i--) { if(i==num.size()-1) { std::cout<<num[i]; } else { std::cout<<std::setfill('0')<<std::setw(9)<<std::right<<num[i]; } } std::cout<<std::endl; }
a.cc: In function 'int main()': a.cc:22:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'? 22 | cin>>n; | ^~~ | std::cin In file included from a.cc:2: /usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ a.cc:23:13: error: 'i' was not declared in this scope 23 | for(i=0;i<n;i++) | ^
s007760920
p00015
C++
#include<cstdio> #include<algorithm> using namespace std; int n; char a[85],b[85],answer[86]; char aa[85],bb[85]; int na=0,nb=0; int main() { scanf("%d",&n); for(int i=0;i<n;i++) { na=0,nb=0; //配列aa(bb)を'0'で初期化 fill(aa,aa+85,'0'); fill(bb,bb+85,'0'); fill(a,a+85,0); fill(b,b+85,0); fill(answer,answer+85,0); scanf("%s%s",a,b); for(int i=0;a[i]!='\0';i++) { na++; } for(int i=0;b[i]!='\0';i++) { nb++; } //配列a(b)を右詰めでaa(bb)に収納する memcpy(aa+85-na,a,sizeof(char)*na); memcpy(bb+85-nb,b,sizeof(char)*nb); //以下足し算 for(int j=84;j>=0;j--) { answer[j]+=aa[j]+bb[j]-'0'; //繰り上げ if(answer[j]>'9') { answer[j-1]++; answer[j]-=10; } } int count=0; for(int j=0;(j<84)&&answer[j]=='0';j++) { count++; } if(count<5) { printf("overflow\n"); } else { answer[85]='\0';//文字列終了のお知らせ memcpy(answer,answer+count,85-count+1); //出力 printf("%s\n",answer); } } }
a.cc: In function 'int main()': a.cc:32:17: error: 'memcpy' was not declared in this scope 32 | memcpy(aa+85-na,a,sizeof(char)*na); | ^~~~~~ a.cc:3:1: note: 'memcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +++ |+#include <cstring> 3 | using namespace std;
s105109828
p00015
C++
#include<iostream> #include<string> #include<algorithm> using namespace std; int main(){ int n; cin>>n; cin.ignore(); while(n--){ string a,b; getline(cin,a); int as = a.size()-1; int bs = b.size()-1; int nmi = min(a.size(),b.size()); int nma = max(a.size(),b.size()); for(int x; i<nma; i++){ if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;} else if(i>as){x = tab+b[bs-i]-'0';} else if(i>bs){x = tab+a[as-i]-'0';} tab = x/10; num[i] = x%10; } if(tab){num[nma] = tab;i++;} if(i>80){cout <<"overflow"<<endl;} else{ for(int x=i-1; x>=0; x--){ cout <<num[x]; } cout <<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:16:16: error: 'i' was not declared in this scope 16 | for(int x; i<nma; i++){ | ^ a.cc:17:21: error: 'tab' was not declared in this scope 17 | if(i<nmi){x = tab+a[as-i]+b[bs-i]-'0'*2;} | ^~~ a.cc:18:25: error: 'tab' was not declared in this scope 18 | else if(i>as){x = tab+b[bs-i]-'0';} | ^~~ a.cc:19:25: error: 'tab' was not declared in this scope 19 | else if(i>bs){x = tab+a[as-i]-'0';} | ^~~ a.cc:20:7: error: 'tab' was not declared in this scope 20 | tab = x/10; | ^~~ a.cc:21:7: error: 'num' was not declared in this scope; did you mean 'enum'? 21 | num[i] = x%10; | ^~~ | enum a.cc:23:8: error: 'tab' was not declared in this scope 23 | if(tab){num[nma] = tab;i++;} | ^~~ a.cc:23:13: error: 'num' was not declared in this scope; did you mean 'enum'? 23 | if(tab){num[nma] = tab;i++;} | ^~~ | enum a.cc:23:28: error: 'i' was not declared in this scope 23 | if(tab){num[nma] = tab;i++;} | ^ a.cc:24:8: error: 'i' was not declared in this scope 24 | if(i>80){cout <<"overflow"<<endl;} | ^ a.cc:27:16: error: 'num' was not declared in this scope; did you mean 'enum'? 27 | cout <<num[x]; | ^~~ | enum
s077475407
p00015
C++
#include<iostream> #include<string> using namespace std; int main(void){ int n; scanf("%d",&n); for(int i=0;i<n;i++){ string a,b,ans; cin >> a; cin >> b; reverse(a.begin(),a.end()); reverse(b.begin(),b.end()); int c=0; for(int j=0;j<max(a.size(),b.size());j++){ string d; int e; e=c; if(a.size()>j)e+=a[j]-'0'; if(b.size()>j)e+=b[j]-'0'; c=0; if(e>=10)c=1,e-=10; d=e+'0'; ans+=d; } reverse(ans.begin(),ans.end()); if(ans.size()<=80)cout << ans << endl; else cout << "overflow" << endl; } return 0; }
a.cc: In function 'int main()': a.cc:12:17: error: 'reverse' was not declared in this scope 12 | reverse(a.begin(),a.end()); | ^~~~~~~
s964500745
p00015
C++
/*****include*****/ #include <iostream> #include <fstream> /*****デバッグ定義*****/ //#define DEBUG /*****マクロ定義*****/ /*****名前空間*****/ using namespace std; /*****グローバル変数置き場*****/ /*****その他関数置き場*****/ /*****main関数*****/ int main(){ /*****ファイルオープン*****/ #ifdef DEBUG ofstream fout("output.txt"); ifstream fin("input.txt"); if(!fout || !fin){ cout << "Can't open the file.\n"; return; } #endif /*****変数置き場*****/ char number1[81]; char number2[81]; int sum[81]; int digit1; int digit2; int digit_sum; int move_up; int i,j; /*****処理部*****/ memset(number1,'0',sizeof(number1)); memset(number2,'0',sizeof(number1)); digit1 = 0; digit2 = 0; digit_sum = 0; cin >> number1; cin >> number2; while(number1[digit1] != '\0') digit1++; while(number2[digit2] != '\0') digit2++; move_up = 0; //cout << digit1 << " " << digit2 << endl; if(digit1 != digit2){ if(digit1 > digit2){ i = digit1; j = digit2; while(j>=0){ number2[i] = number2[j]; number2[j] = '0'; i--;j--; } }else{ i = digit1; j = digit2; while(i>=0){ number1[j] = number1[i]; number1[i] = '0'; i--;j--; } } } /*for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ cout << number1[i-1]; } cout << endl; for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ cout << number2[i-1]; } cout << endl;*/ //for(int i=0;i<4;i++) cout << number2[i] << " " << atoi(&number2[i]) << endl; //for(int i=0;i<4;i++) cout << number1[i] << " " << atoi(&number1[i]) << endl; digit_sum = 0; for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ //cout << atoi(&number1[i-1]) << " " << atoi(&number2[i-1]) << endl; sum[digit_sum] = number1[i-1] - '0' + number2[i-1] - '0' + move_up; if(sum[digit_sum] >= 10){ move_up = 1; sum[digit_sum] = sum[digit_sum] % 10; }else{ move_up = 0; } digit_sum++; } if(move_up == 1){ sum[digit_sum] = move_up; digit_sum++; } //cout << digit_sum << endl; if(digit_sum > 79) cout << "overflow" << endl; else{ for(int k=digit_sum-1;k>=0;k--){ cout << sum[k]; } cout << endl; } /*****処理終了後*****/ #ifdef DEBUG fout.close(); fin.close(); #endif return 0; }
a.cc: In function 'int main()': a.cc:37:9: error: 'memset' was not declared in this scope 37 | memset(number1,'0',sizeof(number1)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <fstream> +++ |+#include <cstring> 4 |
s316454122
p00015
C++
/*****include*****/ #include <iostream> #include <fstream> /*****デバッグ定義*****/ //#define DEBUG /*****マクロ定義*****/ /*****名前空間*****/ using namespace std; /*****グローバル変数置き場*****/ /*****その他関数置き場*****/ /*****main関数*****/ int main(){ /*****ファイルオープン*****/ #ifdef DEBUG ofstream fout("output.txt"); ifstream fin("input.txt"); if(!fout || !fin){ cout << "Can't open the file.\n"; return; } #endif /*****変数置き場*****/ char number1[81]; char number2[81]; int sum[81]; int digit1; int digit2; int digit_sum; int move_up; int i,j; int n; /*****処理部*****/ cin >> n; for(int loop=0;loop<n;loop++){ memset(number1,'0',sizeof(number1)); memset(number2,'0',sizeof(number1)); digit1 = 0; digit2 = 0; cin >> number1; cin >> number2; while(number1[digit1] != '\0') digit1++; while(number2[digit2] != '\0') digit2++; move_up = 0; //cout << digit1 << " " << digit2 << endl; if(digit1 != digit2){ if(digit1 > digit2){ i = digit1; j = digit2; while(j>=0){ number2[i] = number2[j]; number2[j] = '0'; i--;j--; } }else{ i = digit1; j = digit2; while(i>=0){ number1[j] = number1[i]; number1[i] = '0'; i--;j--; } } } /*for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ cout << number1[i-1]; } cout << endl; for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ cout << number2[i-1]; } cout << endl;*/ //for(int i=0;i<4;i++) cout << number2[i] << " " << atoi(&number2[i]) << endl; //for(int i=0;i<4;i++) cout << number1[i] << " " << atoi(&number1[i]) << endl; digit_sum = 0; for(int i=((digit1 > digit2)? digit1 : digit2);i>0;i--){ //cout << atoi(&number1[i-1]) << " " << atoi(&number2[i-1]) << endl; sum[digit_sum] = number1[i-1] - '0' + number2[i-1] - '0' + move_up; if(sum[digit_sum] >= 10){ move_up = 1; sum[digit_sum] = sum[digit_sum] % 10; }else{ move_up = 0; } digit_sum++; } if(move_up == 1){ sum[digit_sum] = move_up; digit_sum++; } //cout << digit_sum << endl; if(digit_sum > 79) cout << "overflow" << endl; else{ for(int k=digit_sum-1;k>=0;k--){ cout << sum[k]; } cout << endl; } } /*****処理終了後*****/ #ifdef DEBUG fout.close(); fin.close(); #endif return 0; }
a.cc: In function 'int main()': a.cc:40:17: error: 'memset' was not declared in this scope 40 | memset(number1,'0',sizeof(number1)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <fstream> +++ |+#include <cstring> 4 |
s334580686
p00015
C++
n = STDIN.gets.to_i while n > 0 line = STDIN.gets line =~ /(\d+)/ a = $1.to_i line = STDIN.gets line =~ /(\d+)/ b = $1.to_i puts a+b n -= 1 end
a.cc:5:19: error: stray '\' in program 5 | line =~ /(\d+)/ | ^ a.cc:8:19: error: stray '\' in program 8 | line =~ /(\d+)/ | ^ a.cc:1:1: error: 'n' does not name a type 1 | n = STDIN.gets.to_i | ^
s215561946
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include <utility> using namespace std; using namespace std; int main(){ int m; char in[2][10000]; char ans[100000]; int ie[2]; int ien[2]; bool max10; int Min; bool NMin; scanf("%d",&m); for(;m--;){ for(int i=0;i<2;i++){ scanf(" %s",&in[i]); } for(int i=0;i<2;i++){ for(ie[i]=0;in[i][ie[i]]!='\0';ie[i]++){ in[i][ie[i]]=in[i][ie[i]]-'0'; } } ie[0]--; ie[1]--; Min=max(ie[0],ie[1]); if(Min>80){ cout<<"overflow"<<endl; }else if(Min>79){ if((int(ie[0][0])+int(ie[1][0]))>9){ cout<<"overflow"<<endl; } }else{ if(ie[0]>ie[1]){ NMin=0; }else{ NMin=1; } ien[0]=ie[0]; ien[1]=ie[1]; for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){ in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]; if(in[NMin][ien[NMin]+1]>9){ in[NMin][ien[NMin]+1]-=10; in[NMin][ien[NMin]] +=1; } } max10=0; if(in[NMin][ien[NMin]+1]>9){ in[NMin][ien[NMin]+1]-=10; max10=1; } for(int i=0;i<2;i++){ for(int j=0;j<ie[i]+1;j++){ in[i][j]=in[i][j]+'0'; } } if(max10) cout<<"1"; cout<<in[NMin]<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:34:38: error: invalid types 'int[int]' for array subscript 34 | if((int(ie[0][0])+int(ie[1][0]))>9){ | ^ a.cc:34:52: error: invalid types 'int[int]' for array subscript 34 | if((int(ie[0][0])+int(ie[1][0]))>9){ | ^
s731431062
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include <utility> using namespace std; using namespace std; int main(){ int m; char in[2][100]; char ans[100]; int ie[2]; int ien[2]; bool max10; int Min; bool NMin; scanf("%d",&m); for(;m--;){ for(int i=0;i<2;i++){ scanf(" %s",&in[i]); } ie[0]=strlen(in[0])-1; ie[1]=strlen(in[1])-1; Min=max(ie[0],ie[1]); if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){ cout<<"overflow"<<endl; }else{ if(ie[0]>ie[1]){ NMin=0; }else{ NMin=1; } ien[0]=ie[0]; ien[1]=ie[1]; for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){ in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0'; if(in[NMin][ien[NMin]]>9+'0'){ in[NMin][ien[NMin]]-=10; in[NMin][ien[NMin]-1] +=1; } } max10=0; for(;ien[NMin]>-1;ien[NMin]--){ if(in[NMin][ien[NMin]]>9+'0'){ in[NMin][ien[NMin]]-=10; in[NMin][ien[NMin]-1]+=1; max10=1; }else{ max10=0; } } if(max10) cout<<"1"; cout<<in[NMin]<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:23:23: error: 'strlen' was not declared in this scope 23 | ie[0]=strlen(in[0])-1; | ^~~~~~ a.cc:5:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 4 | #include <utility> +++ |+#include <cstring> 5 | using namespace std;
s683538608
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include<string> #include <utility> using namespace std; using namespace std; int main(){ int m; char in[2][100]; char ans[100]; int ie[2]; int ien[2]; bool max10; int Min; bool NMin; scanf("%d",&m); for(;m--;){ for(int i=0;i<2;i++){ scanf(" %s",&in[i]); } ie[0]=strlen(in[0])-1; ie[1]=strlen(in[1])-1; Min=max(ie[0],ie[1]); if((Min>79)||((Min>78)&&(ie[0]==ie[1])&&((int(in[0][0])+int(in[1][0]))>9))){ cout<<"overflow"<<endl; }else{ if(ie[0]>ie[1]){ NMin=0; }else{ NMin=1; } ien[0]=ie[0]; ien[1]=ie[1]; for(;min(ien[0],ien[1])+1;ien[0]--,ien[1]--){ in[NMin][ien[NMin]]=in[0][ien[0]]+in[1][ien[1]]-'0'; if(in[NMin][ien[NMin]]>9+'0'){ in[NMin][ien[NMin]]-=10; in[NMin][ien[NMin]-1] +=1; } } max10=0; for(;ien[NMin]>-1;ien[NMin]--){ if(in[NMin][ien[NMin]]>9+'0'){ in[NMin][ien[NMin]]-=10; in[NMin][ien[NMin]-1]+=1; max10=1; }else{ max10=0; } } if(max10) cout<<"1"; cout<<in[NMin]<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:24:23: error: 'strlen' was not declared in this scope 24 | ie[0]=strlen(in[0])-1; | ^~~~~~ a.cc:6:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 5 | #include <utility> +++ |+#include <cstring> 6 | using namespace std;
s767027817
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include<string> #include <utility> using namespace std; using namespace std; int main(){ int m; string in,in2; int a[90],b[90],ans[90]; int f; int a_len,b_len,m_len; cin>>m; while(m--){ for(int i=0;i<90;i++){ a[i]=b[i]=ans[i]=0; } cin>>in; cin>>in2; a_len=in.size(); b_len=in2.size(); for(int i=0;i<a_len;i++){ a[a_len-1-i]=in[i]-'0'; } for(int i=0;i<b_len;i++){ b[b_len-1-i]=in2[i]-'0'; } m_len=max(a_len,b_len); if(m_len>80){ cout<<"overflow"<<endl; continue; } f=0; for(int i=0;i<m_len+1;i++){ ans[i]=(a[i]+b[i]+f)%10; f=(a[i]+b[i]+f)/10; } if(ans[m_len]!=0){ printf("%d",ans[0]) } } return 0; }
a.cc: In function 'int main()': a.cc:40:44: error: expected ';' before '}' token 40 | printf("%d",ans[0]) | ^ | ; 41 | } | ~
s992973209
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include<string.h> #include <utility> using namespace std; using namespace std; int main(){ int m; string in[90],in2[90]; int a[90],b[90],ans[90]; int f; int a_len,b_len,m_len; cin>>m; while(m--){ for(int i=0;i<90;i++){ a[i]=b[i]=ans[i]=0; } cin>>in; cin>>in2; a_len=in.size(); b_len=in2.size(); for(int i=0;i<a_len;i++){ a[a_len-1-i]=in[i]-'0'; } for(int i=0;i<b_len;i++){ b[b_len-1-i]=in[i]-'0'; } m_len=max(a_len,b_len); /* if(m_len>80){ cout<<"overflow"<<endl; continue; } f=0; for(int i=0;i<m_len+1;i++){ ans[i]=(a[i]+b[i]+f)%10; f=(a[i]+b[i]+f)/10; } if(ans[m_len]!=0){ if(m_len>79){ cout<<"overflow"<<endl; continue; } cout<<ans[m_len]; } for(int i=0;i<m_len;i++){ cout<<ans[m_len-1-i]; }cout<<endl; */ } return 0; }
a.cc: In function 'int main()': a.cc:19:20: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'std::string [90]' {aka 'std::__cxx11::basic_string<char> [90]'}) 19 | cin>>in; | ~~~^~~~ | | | | | std::string [90] {aka std::__cxx11::basic_string<char> [90]} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from a.cc:1: /usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} 19 | cin>>in; | ^~ /usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(short int)((std::string*)(& in))' to 'short int&' /usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'short unsigned int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(short unsigned int)((std::string*)(& in))' to 'short unsigned int&' /usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(int)((std::string*)(& in))' to 'int&' /usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'unsigned int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(unsigned int)((std::string*)(& in))' to 'unsigned int&' /usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(long int)((std::string*)(& in))' to 'long int&' /usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long unsigned int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(long unsigned int)((std::string*)(& in))' to 'long unsigned int&' /usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 199 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(long long int)((std::string*)(& in))' to 'long long int&' /usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 203 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: invalid conversion from 'std::string*' {aka 'std::__cxx11::basic_string<char>*'} to 'long long unsigned int' [-fpermissive] 19 | cin>>in; | ^~ | | | std::string* {aka std::__cxx11::basic_string<char>*} a.cc:19:22: error: cannot bind rvalue '(long long unsigned int)((std::string*)(& in))' to 'long long unsigned int&' /usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match) 328 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed: a.cc:19:22: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*' 19 | cin>>in; | ^~ /usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 219 | operator>>(float& __f) | ^~~~~~~~ /usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from 'std::string [90]' {aka 'std::__cxx11::basic_string<char> [90]'} to 'float&' 219 | operator>>(float& __f) | ~~~~~~~^~~ /usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 223 | operator>>(double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from 'std::string [90]' {aka 'std::__cxx11::basic_string<char> [90]'} to 'double&' 223 | operator>>(double& __f) | ~~~~~~~~^~~ /usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' 227 | operator>>(long double& __f) | ^~~~~~~~ /usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from 'std::string [90]' {aka 'std::__cxx11::basic_string<char> [90]'} to 'long double&' 227 | operator>>(long double& __f) | ~~~~~~~~~~~~~^~~ /usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_i
s523673572
p00015
C++
#include<iostream> #include<stdio.h> #include <algorithm> #include<string.h> #include <utility> using namespace std; using namespace std; int main(){ int m; string in,in2; int a[90],b[90],ans[90]; int f; int alen,blen,mlen; cin>>m; while(m--){ for(int i=0;i<90;i++){ a[i]=b[i]=ans[i]=0; } cin>>in; cin>>in2; alen=in.size(); blen=in2.size(); for(int i=0;i<alen;i++){ a[alen-1-i]=in[i]-'0'; } for(int i=0;i<blen;i++){ b[blen-1-i]=in[i]-'0'; } mlen=max(alen,blen); if(mlen>80){ cout<<"overflow"<<endl; continue; } f=0; for(int i=0;i<mlen+1;i++){ ans[i]=(a[i]+b[i]+f)%10; f=(a[i]+b[i]+f)/10; } if(ans[mlen]!=0){ if(mlen>79){ //cout<<"overflow"<<endl; continue; //} //cout<<ans[mlen]; } for(int i=0;i<mlen;i++){ //cout<<ans[mlen-1-i]; }cout<<endl; } return 0; }
a.cc: In function 'int main()': a.cc:54:2: error: expected '}' at end of input 54 | } | ^ a.cc:8:11: note: to match this '{' 8 | int main(){ | ^
s398414048
p00015
C++
#include <stdio.h> #include <string.h> int main(void) { char str[2][1000]; int b, s; int len[2]; int i, j; int n; int flag; scanf("%d", &n); while (n){ for (i = 0; i < 1000; i++){ str[0][i] = str[1][i] = 0; } s = 1; b = 0; for (i = 0; i < 2; i++){ scanf("%s", str[i]); len[i] = strlen(str[i]); } else { if (len[0] > 80 || len[1] > 80){ printf("overflow\n"); break; } if (len[0] < len[1]){ s = 0; b = 1; } for (i = len[b], j = len[s]; i >= 0; i--, j--){ if (j >= 0){ str[s][i] = str[s][j]; } else { str[s][i] = '0'; } } flag = 0; i = len[b]; while (i >= 0){ if (str[s][i] + str[b][i] - '0' + flag > '9'){ flag = 1; } else { flag = 0; } i--; } if (flag){ for (i = len[b]; i >= 0; i--){ for (j = 0; j < 2; j++){ str[j][i + 1] = str[j][i]; } } str[0][0] = '0'; str[1][0] = '0'; } for (i = len[b]; j >= 0; i--){ str[b][i] += (str[s][i] - '0'); if (str[b][i] > '9'){ str[b][i] -= 10; str[b][i - 1]++; } } str[b][len[b] + flag] = '\0'; printf("%s\n", str[b]); } n--; } return (0); }
a.cc: In function 'int main()': a.cc:27:17: error: 'else' without a previous 'if' 27 | else { | ^~~~
s203192581
p00015
C++
int add(char *retstr, char *str1, char *str2){ int str1len=strlen(str1); int str2len=strlen(str2); char ad,i1,i2; char offset1,offset2; char c1,c2; bool carry=false; if(str1len>str2len){ offset1=0; offset2=str1len-str2len; }else{ offset1=str2len-str1len; offset2=0; } for(int i=max(str1len,str2len);i<82;++i){ retstr[i]=0; } for(int i=max(str1len,str2len)-1;i>=0;--i){ if(i-offset1>=0){c1=str1[i-offset1];}else{c1=48;} if(i-offset2>=0){c2=str2[i-offset2];}else{c2=48;} i1=c1-48;i2=c2-48;//Ascii code to Number ad=i1+i2; if(carry)++ad;//桁上がり分 if(ad>=10){ad %= 10; carry=true;}else{carry=false;} retstr[i+1]=ad+48; } if(carry){ retstr[0]=1+48; }else{ retstr[0]=0+48; for(int i=0;i<strlen(retstr)-1;++i){ retstr[i]=retstr[i+1]; } retstr[strlen(retstr)-1]=0; } if(strlen(retstr)>=81)return 1; return 0; } int main(){ int n,overflowed; char str1[82], str2[82], retstr[82]; cin>>n; for(int i=0;i<n;++i){ cin>>str1; cin>>str2; if(strlen(str1)>=81||strlen(str2)>=81){ cout<<"overflow"<<endl; }else{ overflowed=add(retstr, str1, str2); if(overflowed){ cout<<"overflow"<<endl; }else{ cout<<retstr<<endl; } } } return 0; }
a.cc: In function 'int add(char*, char*, char*)': a.cc:3:21: error: 'strlen' was not declared in this scope 3 | int str1len=strlen(str1); | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int add(char *retstr, char *str1, char *str2){ a.cc:18:19: error: 'max' was not declared in this scope 18 | for(int i=max(str1len,str2len);i<82;++i){ | ^~~ a.cc:22:19: error: 'max' was not declared in this scope 22 | for(int i=max(str1len,str2len)-1;i>=0;--i){ | ^~~ a.cc: In function 'int main()': a.cc:56:9: error: 'cin' was not declared in this scope 56 | cin>>n; | ^~~ a.cc:63:20: error: 'strlen' was not declared in this scope 63 | if(strlen(str1)>=81||strlen(str2)>=81){ | ^~~~~~ a.cc:63:20: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:64:25: error: 'cout' was not declared in this scope 64 | cout<<"overflow"<<endl; | ^~~~ a.cc:64:43: error: 'endl' was not declared in this scope 64 | cout<<"overflow"<<endl; | ^~~~ a.cc:68:33: error: 'cout' was not declared in this scope 68 | cout<<"overflow"<<endl; | ^~~~ a.cc:68:51: error: 'endl' was not declared in this scope 68 | cout<<"overflow"<<endl; | ^~~~ a.cc:70:33: error: 'cout' was not declared in this scope 70 | cout<<retstr<<endl; | ^~~~ a.cc:70:47: error: 'endl' was not declared in this scope 70 | cout<<retstr<<endl; | ^~~~
s409316927
p00015
C++
int add(char *retstr, char *str1, char *str2){ int str1len=strlen(str1); int str2len=strlen(str2); char ad,i1,i2; char offset1,offset2; char c1,c2; bool carry=false; if(str1len>str2len){ offset1=0; offset2=str1len-str2len; }else{ offset1=str2len-str1len; offset2=0; } for(int i=max(str1len,str2len);i<82;++i){ retstr[i]=0; } for(int i=max(str1len,str2len)-1;i>=0;--i){ if(i-offset1>=0){c1=str1[i-offset1];}else{c1=48;} if(i-offset2>=0){c2=str2[i-offset2];}else{c2=48;} i1=c1-48;i2=c2-48;//Ascii code to Number ad=i1+i2; if(carry)++ad;//桁上がり分 if(ad>=10){ad %= 10; carry=true;}else{carry=false;} retstr[i+1]=ad+48; } if(carry){ retstr[0]=1+48; }else{ retstr[0]=0+48; for(unsigned int i=0;i<strlen(retstr)-1;++i){ retstr[i]=retstr[i+1]; } retstr[strlen(retstr)-1]=0; } if(strlen(retstr)>=81)return 1; return 0; } int main(){ int n,overflowed; char str1[82], str2[82], retstr[82]; cin>>n; for(int i=0;i<n;++i){ cin>>str1; cin>>str2; if(strlen(str1)>=81||strlen(str2)>=81){ cout<<"overflow"<<endl; }else{ overflowed=add(retstr, str1, str2); if(overflowed){ cout<<"overflow"<<endl; }else{ cout<<retstr<<endl; } } } return 0; }
a.cc: In function 'int add(char*, char*, char*)': a.cc:3:21: error: 'strlen' was not declared in this scope 3 | int str1len=strlen(str1); | ^~~~~~ a.cc:1:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' +++ |+#include <cstring> 1 | int add(char *retstr, char *str1, char *str2){ a.cc:18:19: error: 'max' was not declared in this scope 18 | for(int i=max(str1len,str2len);i<82;++i){ | ^~~ a.cc:22:19: error: 'max' was not declared in this scope 22 | for(int i=max(str1len,str2len)-1;i>=0;--i){ | ^~~ a.cc: In function 'int main()': a.cc:56:9: error: 'cin' was not declared in this scope 56 | cin>>n; | ^~~ a.cc:63:20: error: 'strlen' was not declared in this scope 63 | if(strlen(str1)>=81||strlen(str2)>=81){ | ^~~~~~ a.cc:63:20: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' a.cc:64:25: error: 'cout' was not declared in this scope 64 | cout<<"overflow"<<endl; | ^~~~ a.cc:64:43: error: 'endl' was not declared in this scope 64 | cout<<"overflow"<<endl; | ^~~~ a.cc:68:33: error: 'cout' was not declared in this scope 68 | cout<<"overflow"<<endl; | ^~~~ a.cc:68:51: error: 'endl' was not declared in this scope 68 | cout<<"overflow"<<endl; | ^~~~ a.cc:70:33: error: 'cout' was not declared in this scope 70 | cout<<retstr<<endl; | ^~~~ a.cc:70:47: error: 'endl' was not declared in this scope 70 | cout<<retstr<<endl; | ^~~~
s380335542
p00015
C++
#include<cstdio> #include<algorithm> using namespace std; int main(void) { int y; scanf("%d",&y); for(int z = 0;z < y;z++) { char suji1[82],suji2[82]; char ans[82] = {0}; for(int i = 0;i<82;i++) { suji1[i] = '0'; suji2[i] ='0'; } int overflow = 0; scanf("%s",suji1); scanf("%s",suji2); int suji1s = strlen(suji1); int suji2s = strlen(suji2); int anss; if(suji1s>suji2s) anss = suji1s; else anss = suji2s; suji1[suji1s] = '0'; suji2[suji2s] = '0'; reverse(suji1,suji1+suji1s); reverse(suji2,suji2+suji2s); for(int i = 0;i < 80;i++) { ans[i] = suji1[i]+suji2[i] - '0'; if(ans[i] >= ':') { ans[i] = ans[i] - 10; suji2[i+1] = suji2[i+1]+1; } } if(ans[anss]!= '0') anss++; if(anss >=81) overflow = 1; reverse(ans,ans+anss); ans[anss] = 0; if(overflow >= 1) { printf("overflow\n"); } else { printf("%s\n",ans); } } return 0; }
a.cc: In function 'int main()': a.cc:23:30: error: 'strlen' was not declared in this scope 23 | int suji1s = strlen(suji1); | ^~~~~~ a.cc:3:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 2 | #include<algorithm> +++ |+#include <cstring> 3 | using namespace std;
s645942711
p00015
C++
#include <cstdlib> #include <iostream> #include <string> #define MAX_DIGITS 80 int main(int argc, const char * argv[]) { using namespace std; string num1, num2, result; int count; cin >> count; for (int i = 0; i < count; ++i) { cin >> num1 >> num2; if (num1.size() > MAX_DIGITS || num2.size() > MAX_DIGITS) { result = "overflow"; } else { int co = 0; // carryover reverse(num1.begin(), num1.end()); reverse(num2.begin(), num2.end()); size_t digits = max(num1.size(), num2.size()) + 1; result.resize(digits); for (int j = 0; j < digits; ++j) { string digit1, digit2; digit1 = j < num1.size() ? num1.substr(j, 1) : "0"; digit2 = j < num2.size() ? num2.substr(j, 1) : "0"; int tmp = atoi(digit1.c_str()) + atoi(digit2.c_str()) + co; co = tmp/10; result[j] = char(48 + tmp - co*10); } if (co == 1) result = "overflow"; reverse(result.begin(), result.end()); if (result[0] == '0') result = result.substr(1); } cout << result << endl; } }
a.cc: In function 'int main(int, const char**)': a.cc:20:13: error: 'reverse' was not declared in this scope 20 | reverse(num1.begin(), num1.end()); | ^~~~~~~
s782041934
p00015
C++
#include <iostream> #include <stdio.h> #include <stack> using namespace std; int main() { int k,a,b,c,d,i,j,s; stack<int> st[3]; char n[2][1000]; cin >> d; for (d;d>0;d--) { cin >> n[0] >> n[1]; if (strlen(n[0])>80 || strlen(n[1])>80) { cout << "overflow" << endl; continue;} for (i=0;i<2;i++) for (j=0;n[i][j]!='\0';j++) st[i].push(n[i][j]-'0'); k=0; c=0; while(!st[0].empty() || !st[1].empty()) { if (!st[0].empty()) {a=st[0].top(); st[0].pop();} else a=0; if (!st[1].empty()) {b=st[1].top(); st[1].pop();} else b=0; s=a+b+c; k++; if (s>9) { c=1; s-=10; } else c=0; st[2].push(s); } if ((c==1 && k==80) || k>80) { cout << "overflow" << endl; while(!st[2].empty()) st[2].pop(); } else { if (c==1) cout << 1; while(!st[2].empty()) { cout << st[2].top(); st[2].pop(); } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'strlen' was not declared in this scope 13 | if (strlen(n[0])>80 || strlen(n[1])>80) { cout << "overflow" << endl; continue;} | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <stack> +++ |+#include <cstring> 4 | using namespace std;
s846435595
p00015
C++
#include <iostream> #include <stdio.h> #include <stack> using namespace std; int main() { int k,a,b,c,d,i,j,s; stack<int> st[3]; char n[2][1000]; cin >> d; for (d;d>0;d--) { cin >> n[0] >> n[1]; if (strlen(n[0])>80 || strlen(n[1])>80) { cout << "overflow" << endl; continue;} for (i=0;i<2;i++) for (j=0;n[i][j]!='\0';j++) st[i].push(n[i][j]-'0'); k=0; c=0; while(!st[0].empty() || !st[1].empty()) { if (!st[0].empty()) {a=st[0].top(); st[0].pop();} else a=0; if (!st[1].empty()) {b=st[1].top(); st[1].pop();} else b=0; s=a+b+c; k++; if (s>9) { c=1; s-=10; } else c=0; st[2].push(s); } if ((c==1 && k==80) || k>80) { cout << "overflow" << endl; while(!st[2].empty()) st[2].pop(); } else { if (c==1) cout << 1; while(!st[2].empty()) { cout << st[2].top(); st[2].pop(); } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:13:13: error: 'strlen' was not declared in this scope 13 | if (strlen(n[0])>80 || strlen(n[1])>80) { cout << "overflow" << endl; continue;} | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <stack> +++ |+#include <cstring> 4 | using namespace std;
s573501426
p00015
C++
#include<algorithm> #include<stdio.h> #include<iostream> using namespace std; int main(){ int n,l,m,c; char a[90],b[90]; cin >> n; for(int i=0;i<n;i++){ char s[90] = {0}; scanf("%s%s",a,b); l = strlen(a); m = strlen(b); reverse(a,a+l); reverse(b,b+m); c=0; for(int j=0;j<max(l,m);j++){ int o=c; if(j<l)o += a[j]-'0'; if(j<m)o += b[j]-'0'; c = o>9; s[j] = o%10 + '0'; } l=max(l,m); if(c>0)s[l++]='1'; reverse(s,s+l); if(l>80)cout << "overflow" << endl; else printf("%s\n",s);//cout << s << endl; } return 0; }
a.cc: In function 'int main()': a.cc:13:21: error: 'strlen' was not declared in this scope 13 | l = strlen(a); | ^~~~~~ a.cc:4:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include<iostream> +++ |+#include <cstring> 4 |
s959841057
p00015
C++
#include<algorithm> #include<stdio.h> #include<stdlib.h> #include<string.h> using namespace std; int main(){ int n,l,m,c; char a[90],b[90],s[90]; cin >> n; for(int i=0;i<n;i++){ for(int j=0;j<90;j++)s[j]=0; scanf("%s%s",a,b); l = strlen(a); m = strlen(b); reverse(a,a+l); reverse(b,b+m); c=0; for(int j=0;j<max(l,m);j++){ int o=c; if(j<l)o += a[j]-'0'; if(j<m)o += b[j]-'0'; c = o>9; s[j] = o%10 + '0'; } l=max(l,m); if(c>0)s[l++]='1'; reverse(s,s+l); if(l>80)puts("overflow"); else puts(s); } return 0; }
a.cc: In function 'int main()': a.cc:10:9: error: 'cin' was not declared in this scope 10 | cin >> n; | ^~~ a.cc:5:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' 4 | #include<string.h> +++ |+#include <iostream> 5 |
s794963573
p00015
C++
test
a.cc:1:1: error: 'test' does not name a type 1 | test | ^~~~
s421988438
p00015
C++
n = gets.to_i n.times do a,b = gets.to_i,gets.to_i str = if (a+b) < 10**80 then (a+b) else "overflow" end puts str end
a.cc:1:1: error: 'n' does not name a type 1 | n = gets.to_i | ^
s351854768
p00015
C++
#include <iostream> using namespace std; int main() { int x,a,b,h; cin>>x; for(int i=0; i<x; i++) { while(true) { cin>>a>>b; if(a.size()>=80||b.size()>=80) break; else { cout<<a+b<<endl; } } } return 0; }
a.cc: In function 'int main()': a.cc:13:8: error: request for member 'size' in 'a', which is of non-class type 'int' 13 | if(a.size()>=80||b.size()>=80) break; | ^~~~ a.cc:13:22: error: request for member 'size' in 'b', which is of non-class type 'int' 13 | if(a.size()>=80||b.size()>=80) break; | ^~~~
s960557258
p00015
C++
#include <iostream> using namespace std; int main() { int x,h; double a,b; cin>>x; for(int i=0; i<x; i++) { while(true) { cin>>a>>b; if(a.size()>=80||b.size()>=80) break; else { cout<<a+b<<endl; } } } return 0; }
a.cc: In function 'int main()': a.cc:14:8: error: request for member 'size' in 'a', which is of non-class type 'double' 14 | if(a.size()>=80||b.size()>=80) break; | ^~~~ a.cc:14:22: error: request for member 'size' in 'b', which is of non-class type 'double' 14 | if(a.size()>=80||b.size()>=80) break; | ^~~~
s864912729
p00015
C++
gets;15.times{puts((a=gets.to_i+gets.to_i)>=10**80?"overfllow":a)}
a.cc:1:1: error: 'gets' does not name a type 1 | gets;15.times{puts((a=gets.to_i+gets.to_i)>=10**80?"overfllow":a)} | ^~~~ a.cc:1:6: error: expected unqualified-id before numeric constant 1 | gets;15.times{puts((a=gets.to_i+gets.to_i)>=10**80?"overfllow":a)} | ^~~~~~~~
s085994294
p00015
C++
(n=gets.to_i).times{puts((a=gets.to_i+gets.to_i)>=10**80?"overfllow":a)}
a.cc:1:3: error: expected ')' before '=' token 1 | (n=gets.to_i).times{puts((a=gets.to_i+gets.to_i)>=10**80?"overfllow":a)} | ~ ^ | )
s566372830
p00015
C++
#include <vector> #include <list> #include <map> #include <set> #include <deque> #include <stack> #include <bitset> #include <algorithm> #include <functional> #include <numeric> #include <utility> #include <sstream> #include <queue> #include <iostream> #include <iomanip> #include <cstdio> #include <complex> #include <cmath> #include <cstdlib> #include <cctype> #include <string> #include <cstring> #include <ctime> #include <fstream> #include <stdio.h> using namespace std; //conversion //------------------------------------------ inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();} //typedef //------------------------------------------ typedef vector<int> VI; typedef vector<VI> VVI; typedef vector<double> VEC; typedef vector<VEC> MAT; typedef vector<string> VS; typedef pair<int, int> PII; typedef pair<int, PII> TIII; typedef long long LL; typedef vector<LL> VLL; typedef vector<VLL> VVLL; //container util //------------------------------------------ #define ALL(a) (a).begin(),(a).end() #define RALL(a) (a).rbegin(), (a).rend() #define PB push_back #define MP make_pair #define SZ(a) int((a).size()) #define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i) #define EXIST(s,e) ((s).find(e)!=(s).end()) #define SORT(c) sort((c).begin(),(c).end()) #define MT(a,b,c) MP(a, MP(b, c)) #define T1 first #define T2 second.first #define T3 second.second.first #define T4 second.second.second //repetition //------------------------------------------ #define FOR(i,a,b) for(int i=(a);i<(b);++i) #define REP(i,n) FOR(i,0,n) #define EPS 1.0e-9 inline int getnum(string s, int idx){ if(idx >= s.size())return 0; else return s[idx]-'0'; } string add(string s, string t){ reverse(ALL(s)); reverse(ALL(t)); int n=max(s.length(), t.length()); string r; int ku=0; REP(i,n){ int tmp = getnum(s,i)+getnum(t,i)+ku; r.PB(tmp%10+'0'); ku=tmp/10; } if(ku)r.PB('0'+ku); reverse(ALL(r)); while(r[0]=='0')r.erase(0,1); if(r.size()>80)return "overflow" return r; } int main(){ int t; cin >> t; REP(i,t){ string s1,s2; cin>>s1>>s2; cout << add(s1,s2) << endl; } return 0; }
a.cc: In function 'std::string add(std::string, std::string)': a.cc:88:41: error: expected ';' before 'return' 88 | if(r.size()>80)return "overflow" | ^ | ; 89 | return r; | ~~~~~~
s526513488
p00015
C++
#include <iostream> #include <cstring> #include <cstdlib> using namespace std; const int DIGIT=9; int main() { int n; char buf[81]; int l, x[2], y, z; char buf_part[DIGIT+1]; int a[2][9]; int b[9]; cin >> n; while (n--) { for (int i=0; i<2; i++) { cin >> buf; l = strlen(buf); x[i] = (l+DIGIT-1)/DIGIT; y = (l-1)%DIGIT+1; for (int j=0; j<9; j++) { a[i][j] = 0; } for (int j=0; j<x[i]; j++) { if (!j) { memcpy(buf_part, buf, y); buf_part[y] = '\0'; } else { memcpy(buf_part, &buf[y+DIGIT*(j-1)], DIGIT); buf_part[DIGIT] = '\0'; } a[i][x[i]-j-1] = atoi(buf_part); } } /*for (int i=0; i<9; i++) b[i] = 0; z = (x[0] > x[1]) ? x[0] : x[1]; for (int i=0; i<z; i++) { b[i] = a[0][i] + a[1][i]; if (b[i] >= 1000000000) { a[0][i+1]++; b[i] -= 1000000000; } } if (z<9 && a[0][z]) { b[z] = a[0][z]+a[1][z]; ++z; } if (b[8] >= 100000000) { cout << "overflow" << endl; } else { cout << b[z-1]; for (int i=z-2; i>=0; i--) { cout.fill('0'); cout.width(DIGIT); cout << b[i]; } cout << endl; } }*/ return 0; }
a.cc: In function 'int main()': a.cc:63:2: error: expected '}' at end of input 63 | } | ^ a.cc:7:12: note: to match this '{' 7 | int main() { | ^
s188989571
p00015
C++
#include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include <math.h> #include <stack> using namespace std; int main(){ char d[81]; char e[81]; stack<char> st1; stack<char> st2; stack<int> st3; int n=0; scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%s",d); scanf("%s",e); if(strlen(d)>80||strlen(e)>80){ printf("overflow"); }else{ for(int j=0; j<(strlen(d)); j++){ st1.push(d[j]); } for(int j=0; j<(strlen(e)); j++){ st2.push(e[j]); } int temp=0; char temp_char; while(st1.empty()==false||st2.empty()==false){ if(st1.empty()==false&&st2.empty()==false){ temp_char=st1.top(); temp+=atoi(&temp_char); temp_char=st2.top(); temp+=atoi(&temp_char); st1.pop(); st2.pop(); }else if(st1.empty()==false&&st2.empty()==true){ temp_char=st1.top(); temp+=atoi(&temp_char); st1.pop(); }else if(st1.empty()==true&&st2.empty()==false){ temp_char=st2.top(); temp+=atoi(&temp_char); st2.pop(); } st3.push(temp%10); temp=temp/10; } if(temp!=0){ st3.push(temp); } if(st3.size()>80){ printf("overflow"); }else{ while(st3.empty()==false){ printf("%d",st3.top()); st3.pop(); } } printf("\n"); } } }
a.cc: In function 'int main()': a.cc:25:12: error: 'strlen' was not declared in this scope 25 | if(strlen(d)>80||strlen(e)>80){ | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <stack> +++ |+#include <cstring> 7 |
s888392250
p00015
C++
#include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include <math.h> #include <stack> using namespace std; int main(){ char d[81]; char e[81]; stack<char> st1; stack<char> st2; stack<int> st3; int n=0; scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%s",d); scanf("%s",e); if((int)(strlen(d))>80||(int)(strlen(e))>80){ printf("overflow"); }else{ for(int j=0; j<(int)(strlen(d)); j++){ st1.push(d[j]); } for(int j=0; j<(int)(strlen(e)); j++){ st2.push(e[j]); } int temp=0; char temp_char; while(st1.empty()==false||st2.empty()==false){ if(st1.empty()==false&&st2.empty()==false){ temp_char=st1.top(); temp+=atoi(&temp_char); temp_char=st2.top(); temp+=atoi(&temp_char); st1.pop(); st2.pop(); }else if(st1.empty()==false&&st2.empty()==true){ temp_char=st1.top(); temp+=atoi(&temp_char); st1.pop(); }else if(st1.empty()==true&&st2.empty()==false){ temp_char=st2.top(); temp+=atoi(&temp_char); st2.pop(); } st3.push(temp%10); temp=temp/10; } if(temp!=0){ st3.push(temp); } if(st3.size()>80){ printf("overflow"); }else{ while(st3.empty()==false){ printf("%d",st3.top()); st3.pop(); } } printf("\n"); } } }
a.cc: In function 'int main()': a.cc:25:18: error: 'strlen' was not declared in this scope 25 | if((int)(strlen(d))>80||(int)(strlen(e))>80){ | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <stack> +++ |+#include <cstring> 7 |
s001635539
p00015
C++
#include <stdio.h> #include <stdlib.h> #include <string> #include <iostream> #include <math.h> #include <stack> using namespace std; int main(){ char d[81]; char e[81]; stack<char> st1; stack<char> st2; stack<int> st3; int n=0; scanf("%d",&n); for(int i=0; i<n; i++){ scanf("%s",d); scanf("%s",e); //if((int)(strlen(d))>80||(int)(strlen(e))>80){ printf("overflow"); //}else{ for(int j=0; j<(int)(strlen(d)); j++){ st1.push(d[j]); } for(int j=0; j<(int)(strlen(e)); j++){ st2.push(e[j]); } int temp=0; char temp_char; while(st1.empty()==false||st2.empty()==false){ if(st1.empty()==false&&st2.empty()==false){ temp_char=st1.top(); temp+=atoi(&temp_char); temp_char=st2.top(); temp+=atoi(&temp_char); st1.pop(); st2.pop(); }else if(st1.empty()==false&&st2.empty()==true){ temp_char=st1.top(); temp+=atoi(&temp_char); st1.pop(); }else if(st1.empty()==true&&st2.empty()==false){ temp_char=st2.top(); temp+=atoi(&temp_char); st2.pop(); } st3.push(temp%10); temp=temp/10; // } if(temp!=0){ st3.push(temp); } if(st3.size()>80){ printf("overflow"); }else{ while(st3.empty()==false){ printf("%d",st3.top()); st3.pop(); } } printf("\n"); } } }
a.cc: In function 'int main()': a.cc:28:34: error: 'strlen' was not declared in this scope 28 | for(int j=0; j<(int)(strlen(d)); j++){ | ^~~~~~ a.cc:7:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 6 | #include <stack> +++ |+#include <cstring> 7 | a.cc:31:34: error: 'strlen' was not declared in this scope 31 | for(int j=0; j<(int)(strlen(e)); j++){ | ^~~~~~ a.cc:31:34: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s314470390
p00015
C++
#include <iostream> #include <string> using namespace std; int main() { int n,i,j; cin >> n; for(i=0;i<n;i++){ string str1,str2,temp; int kuriagari=0; cin >> str1 >> str2; if (str1.size()<str2.size()){ temp = str1; str1 = str2; str2 = temp; } int goukei[str1.size()+1]; for(j=0;j<str1.size()+1;j++){ if (j==str1.size()){ goukei[0] = kuriagari; }else if (j<str2.size()){ goukei[str1.size()-j] = str2[str2.size()-1-j] + str1[str1.size()-1-j] + kuriagari -'0' - '0'; if (goukei[str1.size()-j] >= 10) { goukei[str1.size()-j] -= 10; kuriagari = 1; }else{ kuriagari = 0; } }else{ goukei[str1.size()-j] = str1[str1.size()-1-j] + kuriagari -'0'; if (goukei[str1.size()-j] >= 10) { goukei[str1.size()-j] -= 10; kuriagari = 1; }else{ kuriagari = 0; } } } if (str.size()>81)||( (str.size()==80)&&(goukei[0]==1) ){ cout << "overflow" <<endl; }else{ if (goukei[0]!=0) cout << goukei[0] ; for(j=0;j<str1.size();j++) cout << goukei[j+1]; cout <<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:44:9: error: 'str' was not declared in this scope; did you mean 'str2'? 44 | if (str.size()>81)||( (str.size()==80)&&(goukei[0]==1) ){ | ^~~ | str2 a.cc:44:23: error: expected primary-expression before '||' token 44 | if (str.size()>81)||( (str.size()==80)&&(goukei[0]==1) ){ | ^~
s009779054
p00015
C++
#include <stdio.h> #include <string.h> int main(void){ int n,ap,bp,cp,t; char a[81],b[81],c[81]; scanf("%d",&n); while(~scanf("%s%s",&a,&b)){ ap=strlen(a); bp=strlen(b); cp=sizeof(c)-1; c[cp]='\0'; t=0; while((t||ap||bp)&&cp>0){ t+=(ap?a[--ap]-'0':0)+(bp?b[--bp]-'0':0); c[--cp]='0'+(t%10); t/=10; } if(t)puts("overflow"); else puts("%s",&c[cp]); } return 0; }
a.cc: In function 'int main()': a.cc:19:18: error: too many arguments to function 'int puts(const char*)' 19 | else puts("%s",&c[cp]); | ~~~~^~~~~~~~~~~~~ In file included from a.cc:1: /usr/include/stdio.h:714:12: note: declared here 714 | extern int puts (const char *__s); | ^~~~
s247151602
p00015
C++
#include <iostream> #include <cstring> using namespace std; int main(){ int j; int n; char s1[111]; char tmp[111]; char s2[111]; char ans[111]; int kuri = 0; cin >> n; while(n--){ memset(ans,0,sizeof(ans)); memset(s1,0,sizeof(s1)); memset(s2,0,sizeof(s2)); memset(tmp,0,sizeof(tmp));) cin >> s1 >> s2; if(strlen(s1) < strlen(s2)){ for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]); for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]); for(int i=0;i<strlen(s2);i++){ if((s2[i] + (s1[i]%'0') + kuri) > '9'){ ans[i] = (s2[i] + (s1[i]%'0') + kuri)-10; kuri = 1; } else { ans[i] = (s2[i] + (s1[i]%'0') + kuri); kuri = 0; } if(i == strlen(s2)-1 && kuri == 1) ans[i+1] = '1'; } if(strlen(ans) > 80) cout << "overflow" << endl; else{ for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i]; } } else{ for(int i=0,j=strlen(s1)-1;i<=j;i++,j--) swap(s1[i],s1[j]); for(int i=0,j=strlen(s2)-1;i<=j;i++,j--) swap(s2[i],s2[j]); for(int i=0;i<strlen(s1);i++){ if((s1[i] + (s2[i]%'0') + kuri) > '9'){ ans[i] = (s1[i] + (s2[i]%'0') + kuri)-10; kuri = 1; } else { ans[i] = (s1[i] + (s2[i]%'0') + kuri); kuri = 0; } if(i == strlen(s1)-1 && kuri == 1) ans[i+1] = '1'; } if(strlen(ans) > 80) cout << "overflow" << endl; else{ for(int i=strlen(ans)-1;i>=0;i--) cout << ans[i]; } } cout << endl; } }
a.cc: In function 'int main()': a.cc:18:29: error: expected primary-expression before ')' token 18 | memset(tmp,0,sizeof(tmp));) | ^
s387256799
p00015
C++
#include <stdio.h> #include <string.h> int main(){ int n,ans[100],kuri,i,j,ap,bp; char a[1000],b[1000]; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%s%s",a,b); if(strlen(a)>80||strlen(b)>80){ printf("overflow\n"); continue; } ap=strlen(a)-1; bp=strlen(b)-1; j=0; kuri=0; while(ap>=0||bp>=0){ ans[j]=kuri; if(ap>=0)ans[j]+=a[ap]; if(bp>=0)ans[j]+=b[bp]; kuri=ans[j]/10; ans[j]%10; j++; ap--; bp--; } if(agari==1)ans[j]==1; else j--; if(j>=80){ printf("overflow\n"); continue; } for(;j>=0;j--){ printf("%d",ans[j]); } printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:28:4: error: 'agari' was not declared in this scope 28 | if(agari==1)ans[j]==1; | ^~~~~
s167919180
p00015
C++
#include <iostream> #include <string> // #include <algorithm> using namespace std; int main() { int tcase; cin >> tcase; while(tcase--) { string A, B, C = ""; cin >> A >> B; unsigned sz = max(A.size(), B.size()); while(A.size()<sz) A = '0' + A; while(B.size()<sz) B = '0' + B; int c = 0; for(int i=sz-1; i>=0; i--) { // 確定情報 C += ( (A[i]-'0') + (B[i]-'0') + c ) % 10 + '0'; // 前座 c = ( (A[i]-'0') + (B[i]-'0') + c ) / 10; } if(c>0) C += ( (A[sz-1]-'0') + (B[sz-1]-'0') + c ) % 10 + '0'; reverse(C.begin(), C.end()); cout << C << endl; } return 0; }
a.cc: In function 'int main()': a.cc:27:5: error: 'reverse' was not declared in this scope 27 | reverse(C.begin(), C.end()); | ^~~~~~~
s924016122
p00015
C++
#include<iostream> #include<algorithm> #include<string> #define MAX 1000 //99999999999999999999999999999999999999999999999999999999999999999999999999999999 using namespace std; int main() { int n = 0; string in[2]; char out[MAX] = {NULL}; cin >> n; for (int i = 0; i < n; i++){ in[0].resize(0); in[1].resize(0); cin >> in[0] >> in[1]; for (int i = 0; i < MAX; i++){ out[i] = '\0'; } int count = in[0].size() - 1; for (int i = 0; i < in[0].size(); i++){ out[count--] += in[0][i]; } count = in[0].size(); int count2 = in[1].size() - 1; count = max(count , count2) - 1; for (int i = 0; i < in[1].size(); i++){ if (out[i] != '\0'){ out[i] -= '0'; } out[i] += in[1][count2--]; count--; } int i = 0; for (i = 0; out[i] != '\0'; i++){ ; } bool flag = false; for (int j = 0; j < i; j++){ if (out[j] > '9'){ out[j] -= 10; out[j + 1] += 1; } } if (out[i] > '\0' && out[i] < '0'){ out[i] += '0'; } for (i = 0; i < out[i] != '\0'; i++){ ; } for (int j = 0; j < i / 2; j++){ char tmp = out[j]; out[j] = out[i - j - 1]; out[i - j - 1] = tmp; } for (i = 0; out[i]; i++){
a.cc: In function 'int main()': a.cc:18:30: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null] 18 | char out[MAX] = {NULL}; | ^ a.cc:52:21: error: redeclaration of 'int i' 52 | int i = 0; | ^ a.cc:22:18: note: 'int i' previously declared here 22 | for (int i = 0; i < n; i++){ | ^ a.cc:81:42: error: expected '}' at end of input 81 | for (i = 0; out[i]; i++){ | ~^ a.cc:81:42: error: expected '}' at end of input a.cc:22:36: note: to match this '{' 22 | for (int i = 0; i < n; i++){ | ^ a.cc:81:42: error: expected '}' at end of input 81 | for (i = 0; out[i]; i++){ | ^ a.cc:15:1: note: to match this '{' 15 | { | ^
s120624634
p00015
C++
#include <iostream> #include <string> using namespace std; int main(void){ int n; cin >> n; for(int i=0;i<n;i++){ int len,mlen=0; char val[2][81]={0},tmp[81],crr=0; for(int j=0;j<2;j++){ cin >> tmp; len = strlen(tmp); mlen = mlen>len?mlen:len; for(int k=0;k<len;k++) val[j][len-1-k]=tmp[k]-0x30; } for(int j=0;j<mlen;j++){ val[0][j]+=val[1][j]+crr; crr=val[0][j]/10; val[0][j]%=10; if(j==mlen-1&&crr) mlen++; } if(!val[0][80]){ for(int j=0;j<mlen;j++) tmp[j]=val[0][mlen-1-j]+0x30; tmp[mlen]='\0'; } else strcpy(tmp,"overflow"); cout << tmp << endl; } return 0; }
a.cc: In function 'int main()': a.cc:16:31: error: 'strlen' was not declared in this scope 16 | len = strlen(tmp); | ^~~~~~ a.cc:2:1: note: 'strlen' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 1 | #include <iostream> +++ |+#include <cstring> 2 | #include <string> a.cc:37:25: error: 'strcpy' was not declared in this scope 37 | strcpy(tmp,"overflow"); | ^~~~~~ a.cc:37:25: note: 'strcpy' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
s514748738
p00015
C++
#include <iostream> #include <string> using namespace std; int main(void){ int n; cin >> n; while(n--){ int len,big; string val[2]; bool crr=false; for(int j=0;j<2;j++){ cin >> val[j]; reverse(val[j].begin(),val[j].end()); } big=val[0].size()>=val[1].size()?0:1; val[1-big].append((len=val[big].size())-val[1-big].size(),'0'); if(len<=80){ for(int j=0;j<len;j++){ val[0][j]+=val[1][j]+crr-0x60; crr=val[0][j]/10; val[0][j]%=10; val[0][j]+=0x30; } if(crr){ val[0].append(1,'1'); len++; } } if(len<=80) reverse(val[0].begin(),val[0].end()); else val[0]="overflow"; cout << val[0] << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:25: error: 'reverse' was not declared in this scope 17 | reverse(val[j].begin(),val[j].end()); | ^~~~~~~ a.cc:38:25: error: 'reverse' was not declared in this scope 38 | reverse(val[0].begin(),val[0].end()); | ^~~~~~~
s858694360
p00015
C++
//Aizu - 0015 : National Budget #include<stdio.h> #include<string.h> int a[1005],b[1005]; int reverse(int *a,int l,int r) { int i,t; for(i=l;i<=r/2;i++) { t=a[i]; a[i]=a[l+r-i]; a[l+r-i]=t; } return 0; } int main() { int n,i,la,lb,lmax,c,tmp; char t; scanf("%d%*c",&n); //霎灘?扈?焚?悟帥謗牙屓霓ヲ隨ヲ while(n--) //隶。邂? { la=0; //貂?峺 lb=0; c=0; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); while(1) //蟄伜?謨ー蟄? { t=getchar(); if(t>='0'&&t<='9') { a[la]=t-'0'; la++; } else if(t=='\n') { break; } } while(1) { t=getchar(); if(t>='0'&&t<='9') { b[lb]=t-'0'; lb++; } else if(t=='\n') { break; } } if(la>80||lb>80) //霎灘?貅「蜃コ蛻、譁ュ { printf("overflow\n"); return 0; } reverse(a,0,la-1); //蜿榊髄 reverse(b,0,lb-1); lmax=(la>lb)?la:lb; for(i=0;i<=lmax;i++) //螟ァ謨ー蜉?ウ? { tmp=a[i]; a[i]=(tmp+b[i]+c)%10; c=(tmp+b[i]+c)/10; } for(i=lmax;i>=0;i--) //霎灘? { if(a[i]!=0) { tmp=i; break; } } if(lmax+1>80) //霎灘?貅「蜃コ蛻、譁ュ { printf("overflow\n"); return 0; } for(i=tmp;i>=0;i--) { printf("%d",a[i]); } printf("\n"); } return 0; }
a.cc: In function 'int main()': a.cc:42:33: error: break statement not within loop or switch 42 | break; | ^~~~~ a.cc: At global scope: a.cc:46:17: error: expected unqualified-id before 'while' 46 | while(1) | ^~~~~ a.cc:60:17: error: expected unqualified-id before 'if' 60 | if(la>80||lb>80) //霎灘?貅「蜃コ蛻、譁ュ | ^~ a.cc:66:24: error: expected constructor, destructor, or type conversion before '(' token 66 | reverse(a,0,la-1); //蜿榊髄 | ^ a.cc:67:24: error: expected constructor, destructor, or type conversion before '(' token 67 | reverse(b,0,lb-1); | ^ a.cc:69:17: error: 'lmax' does not name a type 69 | lmax=(la>lb)?la:lb; | ^~~~ a.cc:70:17: error: expected unqualified-id before 'for' 70 | for(i=0;i<=lmax;i++) //螟ァ謨ー蜉?ウ? { | ^~~ a.cc:70:25: error: 'i' does not name a type 70 | for(i=0;i<=lmax;i++) //螟ァ謨ー蜉?ウ? { | ^ a.cc:70:33: error: 'i' does not name a type 70 | for(i=0;i<=lmax;i++) //螟ァ謨ー蜉?ウ? { | ^ a.cc:72:25: error: 'a' does not name a type 72 | a[i]=(tmp+b[i]+c)%10; | ^ a.cc:73:25: error: 'c' does not name a type 73 | c=(tmp+b[i]+c)/10; | ^ a.cc:74:17: error: expected declaration before '}' token 74 | } | ^ a.cc:76:17: error: expected unqualified-id before 'for' 76 | for(i=lmax;i>=0;i--) //霎灘? | ^~~ a.cc:76:28: error: 'i' does not name a type 76 | for(i=lmax;i>=0;i--) //霎灘? | ^ a.cc:76:33: error: 'i' does not name a type 76 | for(i=lmax;i>=0;i--) //霎灘? | ^ a.cc:85:17: error: expected unqualified-id before 'if' 85 | if(lmax+1>80) //霎灘?貅「蜃コ蛻、譁ュ | ^~ a.cc:91:17: error: expected unqualified-id before 'for' 91 | for(i=tmp;i>=0;i--) | ^~~ a.cc:91:27: error: 'i' does not name a type 91 | for(i=tmp;i>=0;i--) | ^ a.cc:91:32: error: 'i' does not name a type 91 | for(i=tmp;i>=0;i--) | ^ a.cc:95:23: error: expected constructor, destructor, or type conversion before '(' token 95 | printf("\n"); | ^ a.cc:96:9: error: expected declaration before '}' token 96 | } | ^ a.cc:97:9: error: expected unqualified-id before 'return' 97 | return 0; | ^~~~~~ a.cc:98:1: error: expected declaration before '}' token 98 | } | ^
s221548709
p00015
C++
#include <iostream> #include <string> #include <vector> using namespace std; int main() { string s1, s2, temp; int sum, flag; int a, b; vector<int> v; int T; cin >> T; while (T--) { cin >> s1 >> s2; v.clear(); sum = 0; flag = 0; reverse(s1.begin(), s1.end()); reverse(s2.begin(), s2.end()); if (s1.size() < s2.size()) { temp = s1; s1 = s2; s2 = temp; } for (int i = 0; i < s1.size(); ++i) { if (s1[i] == '0')a = 0; else if (s1[i] == '1')a = 1; else if (s1[i] == '2')a = 2; else if (s1[i] == '3')a = 3; else if (s1[i] == '4')a = 4; else if (s1[i] == '5')a = 5; else if (s1[i] == '6')a = 6; else if (s1[i] == '7')a = 7; else if (s1[i] == '8')a = 8; else if (s1[i] == '9')a = 9; if (i >= s2.size())b = 0; else { if (s2[i] == '0')b = 0; else if (s2[i] == '1')b = 1; else if (s2[i] == '2')b = 2; else if (s2[i] == '3')b = 3; else if (s2[i] == '4')b = 4; else if (s2[i] == '5')b = 5; else if (s2[i] == '6')b = 6; else if (s2[i] == '7')b = 7; else if (s2[i] == '8')b = 8; else if (s2[i] == '9')b = 9; } sum = a + b + flag; if (sum > 9) { sum = sum - 10; flag = 1; } else { flag = 0; } v.push_back(sum); } if (flag == 1) v.push_back(1); if (v.size() > 80) cout << "overflow" << endl; else { for (int i = v.size() - 1; i >= 0; --i) { cout << v[i]; } cout << endl; } } return 0; }
a.cc: In function 'int main()': a.cc:20:17: error: 'reverse' was not declared in this scope 20 | reverse(s1.begin(), s1.end()); | ^~~~~~~
s651967366
p00015
C++
#include <cstdio> #include <iostream> #include <vector> #include <cstring> using namespace std; int main(){ int n; cin >> n; while( n-- > 0 ){ string num1, num2; cin >> num1 >> num2; char sum[101]; int degit = 0; for( int i = 0; i < 101; i++ ) sum[i] = '0'; for( int i = 0; i < num1.size(); i++ ){ sum[100-i] = num1[num1.size()-i-1]; } int d; for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){ int now = 3; /* if( i < num2.size() ){ now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit; }else{ now = (int)(sum[100-i]-'0') + degit; } */ sum[100-i] = (char)(now%10)+'0'; if( now >= 10 ) degit = 1; else degit = 0; d = i; } int d = 3; if( d < 80 ){ for( int i = 100-d; i < 101; i++ ) cout << sum[i]; cout << endl; }else{ cout << "overflow" << endl; } } }
a.cc: In function 'int main()': a.cc:34:21: error: redeclaration of 'int d' 34 | int d = 3; | ^ a.cc:19:21: note: 'int d' previously declared here 19 | int d; | ^
s945063361
p00015
C++
#include <cstdio> 2 #include <iostream> 3 #include <vector> 4 #include <cstring> 5 using namespace std; 6 7 int main(){ 8 int n; 9 cin >> n; 10 while( n-- > 0 ){ 11 string num1, num2; 12 cin >> num1 >> num2; 13 char sum[101]; 14 int degit = 0; 15 for( int i = 0; i < 101; i++ ) sum[i] = '0'; 16 for( int i = 0; i < num1.size(); i++ ){ 17 sum[100-i] = num1[num1.size()-i-1]; 18 } 19 int d; 20 for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){ 21 int now; 22 if( i < num2.size() ){ 23 now = (int)(sum[100-i]-'0') + (int)(num2[num2.size()-i-1]-'0') + degit; 24 }else{ 25 now = (int)(sum[100-i]-'0') + degit; 26 } 27 sum[100-i] = (char)(now%10)+'0'; 28 if( now >= 10 ) degit = 1; 29 else degit = 0; 30 d = i; 31 } 32 if( d < 80 ){ 33 for( int i = 100-d; i < 101; i++ ) cout << sum[i]; 34 cout << endl; 35 }else{ 36 cout << "overflow" << endl; 37 } 38 }
a.cc:2:5: error: stray '#' in program 2 | 2 #include <iostream> | ^ a.cc:3:5: error: stray '#' in program 3 | 3 #include <vector> | ^ a.cc:4:5: error: stray '#' in program 4 | 4 #include <cstring> | ^ a.cc:2:3: error: expected unqualified-id before numeric constant 2 | 2 #include <iostream> | ^ a.cc:6:3: error: expected unqualified-id before numeric constant 6 | 6 | ^
s284020159
p00015
C++
#include <cstdio> #include <iostream> #include <vector> #include <cstring> using namespace std; int main(){ int n; cin >> n; while( n-- > 0 ){ string num1, num2; cin >> num1 >> num2; char sum[101]; int degit = 0; for( int i = 0; i < 101; i++ ) sum[i] = '0'; for( int i = 0; i < num1.size(); i++ ){ sum[100-i] = num1[num1.size()-i-1]; } int d; for( int i = 0; i < num1.size() || i < num2.size() || degit != 0; i++ ){ int now; if( i < num2.size() ){ now = (int)sum[100-i]-(int)('0') + (int)(num2[num2.size()-i-1]-(int)('0') + degit; }else{ now = (int)sum[100-i]-(int)('0') + degit; } sum[100-i] = (char)(now%10)+'0'; if( now >= 10 ) degit = 1; else degit = 0; d = i; } if( d < 80 ){ for( int i = 100-d; i < 101; i++ ) cout << sum[i]; cout << endl; }else{ cout << "overflow" << endl; } } }
a.cc: In function 'int main()': a.cc:23:114: error: expected ')' before ';' token 23 | now = (int)sum[100-i]-(int)('0') + (int)(num2[num2.size()-i-1]-(int)('0') + degit; | ~ ^ | )
s848681377
p00015
C++
#include <iostream> #include <vector> #include <string> #include <sstream> class BigInteger { // use 18 digit a element std::vector<uint64_t> splited_num_; public: BigInteger(std::string str) { set_data(str); } BigInteger(std::vector<uint64_t>&& splited_num) { splited_num_ = std::move(splited_num); } BigInteger operator+(const BigInteger& rhs) { return BigInteger(plus(splited_num_, rhs.get_data())); } std::vector<uint64_t> get_data() const {return splited_num_;} std::string to_string() const { std::string ret; const int size = splited_num_.size(); for (int i = 0; i < size; ++i) { const int& n = splited_num_[size - i - 1]; ret += n == 0 ? "000000000000000000" : std::to_string(n); } return ret; } private: void set_data(const std::string& str) { std::string sub; int length = str.length(); while (length >= 18) { int pos = length - 18; sub = str.substr(pos, 18); splited_num_.push_back(to_uint64(sub)); length -= 18; } if (length > 0) { sub = str.substr(0, length); splited_num_.push_back(to_uint64(sub)); } } std::vector<uint64_t> plus(std::vector<uint64_t> lhs, std::vector<uint64_t> rhs) const { std::vector<uint64_t> ret; uint64_t carry = 0; const int max = std::max(lhs.size(), rhs.size()); const int min = std::min(lhs.size(), rhs.size()); // ensure that lhs.sizs() is larger than rhs.size() if (lhs.size() < rhs.size()) { std::swap(lhs, rhs); } // fit container size for (int i = 0; i < (max - min); ++i) { rhs.push_back(0); } for (int i = 0; i < max; ++i) { uint64_t sum = lhs.at(i) + rhs.at(i) + carry; carry = sum / 1000000000000000000; sum = sum % 1000000000000000000; ret.push_back(sum); } if (carry > 0) { ret.push_back(carry); } return ret; } uint64_t to_uint64(const std::string& str) const { std::istringstream iss(str); uint64_t ret = 0; iss >> ret; return ret; } }; int main() { std::vector<BigInteger> ans_list; int n; std::cin >> n; for (int i = 0; i < n; ++i) { std::string str1, str2; std::cin >> str1; std::cin >> str2; BigInteger bi1(str1); BigInteger bi2(str2); ans_list.push_back(bi1 + bi2); } for (auto ans : ans_list) { std::cout << ans.to_string() << std::endl; } }
a.cc:8:21: error: 'uint64_t' was not declared in this scope 8 | std::vector<uint64_t> splited_num_; | ^~~~~~~~ a.cc:5:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 4 | #include <sstream> +++ |+#include <cstdint> 5 | a.cc:8:29: error: template argument 1 is invalid 8 | std::vector<uint64_t> splited_num_; | ^ a.cc:8:29: error: template argument 2 is invalid a.cc:13:32: error: 'uint64_t' was not declared in this scope 13 | BigInteger(std::vector<uint64_t>&& splited_num) { | ^~~~~~~~ a.cc:13:32: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:13:40: error: template argument 1 is invalid 13 | BigInteger(std::vector<uint64_t>&& splited_num) { | ^ a.cc:13:40: error: template argument 2 is invalid a.cc:19:21: error: 'uint64_t' was not declared in this scope 19 | std::vector<uint64_t> get_data() const {return splited_num_;} | ^~~~~~~~ a.cc:19:21: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:29: error: template argument 1 is invalid 19 | std::vector<uint64_t> get_data() const {return splited_num_;} | ^ a.cc:19:29: error: template argument 2 is invalid a.cc:44:21: error: 'uint64_t' was not declared in this scope 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^~~~~~~~ a.cc:44:21: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:44:29: error: template argument 1 is invalid 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^ a.cc:44:29: error: template argument 2 is invalid a.cc:44:48: error: 'uint64_t' was not declared in this scope 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^~~~~~~~ a.cc:44:48: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:44:56: error: template argument 1 is invalid 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^ a.cc:44:56: error: template argument 2 is invalid a.cc:45:68: error: 'uint64_t' was not declared in this scope 45 | std::vector<uint64_t> rhs) const { | ^~~~~~~~ a.cc:45:68: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:45:76: error: template argument 1 is invalid 45 | std::vector<uint64_t> rhs) const { | ^ a.cc:45:76: error: template argument 2 is invalid a.cc:71:9: error: 'uint64_t' does not name a type 71 | uint64_t to_uint64(const std::string& str) const { | ^~~~~~~~ a.cc:71:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In member function 'std::string BigInteger::to_string() const': a.cc:22:47: error: request for member 'size' in '((const BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'const int' 22 | const int size = splited_num_.size(); | ^~~~ a.cc:24:52: error: invalid types 'const int[int]' for array subscript 24 | const int& n = splited_num_[size - i - 1]; | ^ a.cc: In member function 'void BigInteger::set_data(const std::string&)': a.cc:36:38: error: request for member 'push_back' in '((BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'int' 36 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:36:48: error: 'to_uint64' was not declared in this scope 36 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:41:38: error: request for member 'push_back' in '((BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'int' 41 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:41:48: error: 'to_uint64' was not declared in this scope 41 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc: In member function 'int BigInteger::plus(int, int) const': a.cc:46:29: error: 'uint64_t' was not declared in this scope 46 | std::vector<uint64_t> ret; | ^~~~~~~~ a.cc:46:29: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:46:37: error: template argument 1 is invalid 46 | std::vector<uint64_t> ret; | ^ a.cc:46:37: error: template argument 2 is invalid a.cc:47:26: error: expected ';' before 'carry' 47 | uint64_t carry = 0; | ^~~~~ a.cc:49:46: error: request for member 'size' in 'lhs', which is of non-class type 'int' 49 | const int max = std::max(lhs.size(), rhs.size()); | ^~~~ a.cc:49:58: error: request for member 'size' in 'rhs', which is of non-class type 'int' 49 | const int max = std::max(lhs.size(), rhs.size()); | ^~~~ a.cc:50:46: error: request for member 'size' in 'lhs', which is of non-class type 'int' 50 | const int min = std::min(lhs.size(), rhs.size()); | ^~~~ a.cc:50:58: error: request for member 'size' in 'rhs', which is of non-class type 'int' 50 | const int min = std::min(lhs.size(), rhs.size()); | ^~~~ a.cc:52:25: error: request for member 'size' in 'lhs', which is of non-class type 'int' 52 | if (lhs.size() < rhs.size()) { | ^~~~ a.cc:52:38: error: request for member 'size' in 'rhs', which is of non-class type 'int' 52 | if (lhs.size() < rhs.size()) { | ^~~~ a.cc:57:29: error: request for member 'push_back' in 'rhs', which is of non-class type 'int' 57 | rhs.push_back(0); | ^~~~~~~~~ a.cc:61:34: error: expected ';' before 'sum' 61 | uint64_t sum = lhs.at(i) + rhs.at(i) + carry; | ^~~ a.cc:62:25: error: 'carry' was not declared in this scope 62 | carry = sum / 1000000000000000000; | ^~~~~ a.cc:62:33: error: 'sum' was not declared in this scope 62 | carry = sum / 1000000000000000000; | ^~~ a.cc:64:29: error: request for member 'push_back' in 'ret', which is of non-class type 'int' 64 | ret.push_back(sum); | ^~~~~~~~~ a.cc:66:21: error: 'carry' was not declared in this scope 66 | if (carry > 0) { | ^~~~~ a.cc:67:29: error: request for member 'push_back' in 'ret', which is of non-class type 'int' 67 | ret.push_back(carry); | ^~~~~~~~~
s167901639
p00015
C++
#include <iostream> #include <vector> #include <string> #include <sstream> class BigInteger { // use 18 digit a element std::vector<uint64_t> splited_num_; public: BigInteger(std::string str) { set_data(str); } BigInteger(std::vector<uint64_t>&& splited_num) { splited_num_ = std::move(splited_num); } BigInteger operator+(const BigInteger& rhs) { return BigInteger(plus(splited_num_, rhs.get_data())); } std::vector<uint64_t> get_data() const {return splited_num_;} std::string to_string() const { std::string ret(""); const int size = splited_num_.size(); for (int i = 0; i < size; ++i) { const uint64_t& n = splited_num_[size - i - 1]; ret += n == 0 ? "000000000000000000" : std::to_string(n); } return ret; } private: void set_data(const std::string& str) { std::string sub; int length = str.length(); while (length >= 18) { int pos = length - 18; sub = str.substr(pos, 18); splited_num_.push_back(to_uint64(sub)); length -= 18; } if (length > 0) { sub = str.substr(0, length); splited_num_.push_back(to_uint64(sub)); } } std::vector<uint64_t> plus(std::vector<uint64_t> lhs, std::vector<uint64_t> rhs) const { std::vector<uint64_t> ret; uint64_t carry = 0; const int max = std::max(lhs.size(), rhs.size()); const int min = std::min(lhs.size(), rhs.size()); // ensure that lhs.sizs() is larger than rhs.size() if (lhs.size() < rhs.size()) { std::swap(lhs, rhs); } // fit container size for (int i = 0; i < (max - min); ++i) { rhs.push_back(0); } for (int i = 0; i < max; ++i) { uint64_t sum = lhs.at(i) + rhs.at(i) + carry; carry = sum / 1000000000000000000; sum = sum % 1000000000000000000; ret.push_back(sum); } if (carry > 0) { ret.push_back(carry); } return ret; } uint64_t to_uint64(const std::string& str) const { std::istringstream iss(str); uint64_t ret = 0; iss >> ret; return ret; } }; int main() { std::vector<BigInteger> ans_list; int n; std::cin >> n; for (int i = 0; i < n; ++i) { std::string str1, str2; std::cin >> str1; std::cin >> str2; BigInteger bi1(str1); BigInteger bi2(str2); ans_list.push_back(bi1 + bi2); } for (auto ans : ans_list) { std::cout << ans.to_string() << std::endl; } }
a.cc:8:21: error: 'uint64_t' was not declared in this scope 8 | std::vector<uint64_t> splited_num_; | ^~~~~~~~ a.cc:5:1: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 4 | #include <sstream> +++ |+#include <cstdint> 5 | a.cc:8:29: error: template argument 1 is invalid 8 | std::vector<uint64_t> splited_num_; | ^ a.cc:8:29: error: template argument 2 is invalid a.cc:13:32: error: 'uint64_t' was not declared in this scope 13 | BigInteger(std::vector<uint64_t>&& splited_num) { | ^~~~~~~~ a.cc:13:32: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:13:40: error: template argument 1 is invalid 13 | BigInteger(std::vector<uint64_t>&& splited_num) { | ^ a.cc:13:40: error: template argument 2 is invalid a.cc:19:21: error: 'uint64_t' was not declared in this scope 19 | std::vector<uint64_t> get_data() const {return splited_num_;} | ^~~~~~~~ a.cc:19:21: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:19:29: error: template argument 1 is invalid 19 | std::vector<uint64_t> get_data() const {return splited_num_;} | ^ a.cc:19:29: error: template argument 2 is invalid a.cc:44:21: error: 'uint64_t' was not declared in this scope 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^~~~~~~~ a.cc:44:21: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:44:29: error: template argument 1 is invalid 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^ a.cc:44:29: error: template argument 2 is invalid a.cc:44:48: error: 'uint64_t' was not declared in this scope 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^~~~~~~~ a.cc:44:48: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:44:56: error: template argument 1 is invalid 44 | std::vector<uint64_t> plus(std::vector<uint64_t> lhs, | ^ a.cc:44:56: error: template argument 2 is invalid a.cc:45:68: error: 'uint64_t' was not declared in this scope 45 | std::vector<uint64_t> rhs) const { | ^~~~~~~~ a.cc:45:68: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:45:76: error: template argument 1 is invalid 45 | std::vector<uint64_t> rhs) const { | ^ a.cc:45:76: error: template argument 2 is invalid a.cc:71:9: error: 'uint64_t' does not name a type 71 | uint64_t to_uint64(const std::string& str) const { | ^~~~~~~~ a.cc:71:9: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc: In member function 'std::string BigInteger::to_string() const': a.cc:22:47: error: request for member 'size' in '((const BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'const int' 22 | const int size = splited_num_.size(); | ^~~~ a.cc:24:31: error: 'uint64_t' does not name a type 24 | const uint64_t& n = splited_num_[size - i - 1]; | ^~~~~~~~ a.cc:24:31: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:25:32: error: 'n' was not declared in this scope 25 | ret += n == 0 ? "000000000000000000" : std::to_string(n); | ^ a.cc: In member function 'void BigInteger::set_data(const std::string&)': a.cc:36:38: error: request for member 'push_back' in '((BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'int' 36 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:36:48: error: 'to_uint64' was not declared in this scope 36 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:41:38: error: request for member 'push_back' in '((BigInteger*)this)->BigInteger::splited_num_', which is of non-class type 'int' 41 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc:41:48: error: 'to_uint64' was not declared in this scope 41 | splited_num_.push_back(to_uint64(sub)); | ^~~~~~~~~ a.cc: In member function 'int BigInteger::plus(int, int) const': a.cc:46:29: error: 'uint64_t' was not declared in this scope 46 | std::vector<uint64_t> ret; | ^~~~~~~~ a.cc:46:29: note: 'uint64_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' a.cc:46:37: error: template argument 1 is invalid 46 | std::vector<uint64_t> ret; | ^ a.cc:46:37: error: template argument 2 is invalid a.cc:47:26: error: expected ';' before 'carry' 47 | uint64_t carry = 0; | ^~~~~ a.cc:49:46: error: request for member 'size' in 'lhs', which is of non-class type 'int' 49 | const int max = std::max(lhs.size(), rhs.size()); | ^~~~ a.cc:49:58: error: request for member 'size' in 'rhs', which is of non-class type 'int' 49 | const int max = std::max(lhs.size(), rhs.size()); | ^~~~ a.cc:50:46: error: request for member 'size' in 'lhs', which is of non-class type 'int' 50 | const int min = std::min(lhs.size(), rhs.size()); | ^~~~ a.cc:50:58: error: request for member 'size' in 'rhs', which is of non-class type 'int' 50 | const int min = std::min(lhs.size(), rhs.size()); | ^~~~ a.cc:52:25: error: request for member 'size' in 'lhs', which is of non-class type 'int' 52 | if (lhs.size() < rhs.size()) { | ^~~~ a.cc:52:38: error: request for member 'size' in 'rhs', which is of non-class type 'int' 52 | if (lhs.size() < rhs.size()) { | ^~~~ a.cc:57:29: error: request for member 'push_back' in 'rhs', which is of non-class type 'int' 57 | rhs.push_back(0); | ^~~~~~~~~ a.cc:61:34: error: expected ';' before 'sum' 61 | uint64_t sum = lhs.at(i) + rhs.at(i) + carry; | ^~~ a.cc:62:25: error: 'carry' was not declared in this scope 62 | carry = sum / 1000000000000000000; | ^~~~~ a.cc:62:33: error: 'sum' was not declared in this scope 62 | carry = sum / 1000000000000000000; | ^~~ a.cc:64:29: error: request for member 'push_back' in 'ret', which is of non-class type 'int' 64 | ret.push_back(sum); | ^~~~~~~~~ a.cc:66:21: error: 'carry' was not declared in this scope 66 | if (carry > 0) { | ^~~~~ a.cc:67:29: error: request for member 'push_back' in 'ret', which is of non-class type 'int' 67 | ret.push_back(carry); | ^~~~~~~~~
s717923575
p00015
C++
#include <iostream> #include <iomanip> #include <cassert> #include <string> using namespace std; typedef long long ll; const ll BASE = 10000; const int LogB = 4; const int MAX_DIGIT = 100; struct Bigint { ll digit[MAX_DIGIT]; int size; Bigint (int sz = 1, ll a = 0) : size(sz) { memset(digit, 0, sizeof(digit)); digit[0] = a; } }; const Bigint ZERO(1,0), ONE(1, 1); bool operator < (Bigint x, Bigint y) { if (x.size != y.size) return x.size < y.size; for (int i=x.size-1; i>=0; i--) if (x.digit[i] != y.digit[i]) return x.digit[i] < y.digit[i]; return false; } bool operator > (Bigint x, Bigint y) { return y < x; } bool operator <= (Bigint x, Bigint y) { return !(y < x); } bool operator >= (Bigint x, Bigint y) { return !(x < y); } bool operator != (Bigint x, Bigint y) { return x < y || y < x; } bool operator == (Bigint x, Bigint y) { return !(x < y) && !(y < x); } Bigint normal(Bigint x) { ll c = 0; for (int i=0; i<x.size; i++) { while (x.digit[i] < 0) x.digit[i+1] -= 1, x.digit[i] += BASE; ll a = x.digit[i] + c; x.digit[i] = a % BASE; c = a / BASE; } for (; c>0; c /= BASE) x.digit[x.size++] = c % BASE; while (x.size > 1 && x.digit[x.size-1] == 0) x.size--; return x; } Bigint convert(ll a) { return normal(Bigint(1, a)); } Bigint convert(const string& s) { Bigint x; int i = s.size() % LogB; if (i > 0) i -= LogB; for (; i<(int)s.size(); i += LogB) { ll a = 0; for (int j=0; j<LogB; j++) a = 10 * a + (i+j >= 0 ? s[i+j] - '0' : 0); x.digit[x.size++] = a; } reverse(x.digit, x.digit+x.size); return normal(x); } ostream &operator << (ostream& os, Bigint x) { os << x.digit[x.size-1]; for (int i=x.size-2; i>=0; i--) os << setw(LogB) << setfill('0') << x.digit[i]; return os; } istream &operator >> (istream& is, Bigint &x) { string s; is >> s; x = convert(s); return is; } Bigint operator + (Bigint x, Bigint y) { if (x.size < y.size) x.size = y.size; for (int i=0; i<y.size; i++) x.digit[i] += y.digit[i]; return normal(x); } Bigint operator - (Bigint x, Bigint y) { assert(x >= y); for (int i=0; i<y.size; i++) x.digit[i] -= y.digit[i]; return normal(x); } Bigint operator * (Bigint x, Bigint y) { Bigint z(x.size + y.size); for (int i=0; i< x.size; i++) for (int j=0; j<y.size; j++) z.digit[i+j] += x.digit[i] * y.digit[j]; return normal(z); } Bigint operator * (Bigint x, ll a) { for (int i=0; i<x.size; i++) x.digit[i] *= a; return normal(x); } pair<Bigint, ll> divmod(Bigint x, ll a) { ll c = 0, t; for (int i=x.size-1; i>=0; i--) { t = BASE*c + x.digit[i]; x.digit[i] = t / a; c = t % a; } return pair<Bigint, ll>(normal(x), c); } Bigint operator / (Bigint x, ll a) { return divmod(x, a).first; } ll operator % (Bigint x, ll a) { return divmod(x, a).second; } pair<Bigint, Bigint> divmod(Bigint x, Bigint y) { if (x.size < y.size) return pair<Bigint, Bigint>(ZERO, x); int F =BASE / (y.digit[y.size-1] + 1); x = x * F; y = y * F; Bigint z(x.size - y.size + 1); for (int k = z.size - 1, i = x.size-1; k >= 0; k--, i--) { z.digit[k] = (i+1 < x.size ? x.digit[i+1] : 0) * BASE + x.digit[i]; z.digit[k] /= y.digit[y.size-1]; Bigint t(k + y.size); for (int j=0; j < y.size; j++) t.digit[k+j] = z.digit[k] * y.digit[j]; t = normal(t); while (x < t) { z.digit[k] -= 1; for (int j = 0;j<y.size; j++) t.digit[k+j] -= y.digit[j]; t = normal(t); } x = x-t; } return pair<Bigint, Bigint>(normal(z), x/F); } Bigint operator / (Bigint x, Bigint y) { return divmod(x, y).first; } Bigint operator % (Bigint x, Bigint y) { return divmod(x, y).second; } int main() { int n; cin >> n; string s1, s2; for (int i=0; i<n; i++) { cin >> s1 >> s2; Bigint x = convert(s1), y = convert(s2); Bigint z = x + y; if (z.size > 80) cout << "overflow" << endl; else cout << z << endl; } return 0; }
a.cc: In constructor 'Bigint::Bigint(int, ll)': a.cc:18:17: error: 'memset' was not declared in this scope 18 | memset(digit, 0, sizeof(digit)); | ^~~~~~ a.cc:4:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>' 3 | #include <cassert> +++ |+#include <cstring> 4 | #include <string> a.cc: In function 'Bigint convert(const std::string&)': a.cc:62:9: error: 'reverse' was not declared in this scope 62 | reverse(x.digit, x.digit+x.size); | ^~~~~~~
s123706603
p00015
C++
#include "string.h" #include "math.h" #include "stdio.h" #include <iostream> using namespace std; /** Problem0015 : National Budget **/ int main() { string a, b, s; int n, tmp, la, lb; bool up=false; cin >> n; for (int i=0; i<n; i++) { cin >> a >> b; s=""; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); la=(int)a.length(); lb=(int)b.length(); if (la < lb) { swap(la, lb); swap(a, b); } for (int i = 0; i<la-lb; i++) b+='0'; for (int i=0; i<la; i++) { tmp = (a[i]-'0') + (b[i] - '0') + (up?1:0); if (tmp>=10) { s += '0'+tmp%10; up = true; } else { s += '0'+tmp; up = false; } } if (up) s+='1'; reverse(s.begin(), s.end()); if (s.length()>80) cout << "overflow" << endl; else cout << s << endl; } return 0; }
a.cc: In function 'int main()': a.cc:19:17: error: 'reverse' was not declared in this scope 19 | reverse(a.begin(), a.end()); | ^~~~~~~
s717604455
p00015
C++
#include <string> #include <iostream> using namespace std; /** Problem0015 : National Budget **/ int main() { string a, b, s; int n, tmp, la, lb; bool up=false; cin >> n; for (int i=0; i<n; i++) { cin >> a >> b; s=""; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); la=(int)a.length(); lb=(int)b.length(); if (la < lb) { swap(la, lb); swap(a, b); } for (int i = 0; i<la-lb; i++) b+='0'; for (int i=0; i<la; i++) { tmp = (a[i]-'0') + (b[i] - '0') + (up?1:0); if (tmp>=10) { s += '0'+tmp%10; up = true; } else { s += '0'+tmp; up = false; } } if (up) s+='1'; reverse(s.begin(), s.end()); if (s.length()>80) cout << "overflow" << endl; else cout << s << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:17: error: 'reverse' was not declared in this scope 17 | reverse(a.begin(), a.end()); | ^~~~~~~
s443687111
p00015
C++
#include <string> #include <iostream> using namespace std; /** Problem0015 : National Budget **/ int main() { string a, b, s; int n, tmp, la, lb; bool up=false; cin >> n; for (int i=0; i<n; i++) { cin >> a >> b; s=""; std::reverse(a.begin(), a.end()); std::reverse(b.begin(), b.end()); la=(int)a.length(); lb=(int)b.length(); if (la < lb) { swap(la, lb); swap(a, b); } for (int i = 0; i<la-lb; i++) b+='0'; for (int i=0; i<la; i++) { tmp = (a[i]-'0') + (b[i] - '0') + (up?1:0); if (tmp>=10) { s += '0'+tmp%10; up = true; } else { s += '0'+tmp; up = false; } } if (up) s+='1'; std::reverse(s.begin(), s.end()); if (s.length()>80) cout << "overflow" << endl; else cout << s << endl; } return 0; }
a.cc: In function 'int main()': a.cc:17:22: error: 'reverse' is not a member of 'std' 17 | std::reverse(a.begin(), a.end()); | ^~~~~~~ a.cc:18:22: error: 'reverse' is not a member of 'std' 18 | std::reverse(b.begin(), b.end()); | ^~~~~~~ a.cc:42:22: error: 'reverse' is not a member of 'std' 42 | std::reverse(s.begin(), s.end()); | ^~~~~~~
s526355130
p00015
C++
using namespace std; void sum80(int* a, int* b); int get80(string str, int* num); int main(void){ string a80, b80; int a[81], b[81]; int i, N; cin>>N; i=0; while(i<N){ cin>>a80; cin>>b80; if(get80(a80, a)<0 || get80(b80, b)<0){ cout<<"overflow"<<endl; }else{ sum80(a, b); } i++; } return 0; } int get80(string str, int* num){ int d=str.length(); if(d<=80){ for(int i=0; i<d; i++){ num[i]=str[d-1-i]-'0'; } for(int i=d;i<81; i++){ num[i]=0; } return d; }else{ return -1; } } void sum80(int* a, int* b){ int s[81], amari; amari=0; for(int i=0; i<81; i++){ s[i]=(a[i]+b[i]+amari)%10; if(a[i]+b[i]+amari>=10){ amari=1; }else{ amari=0; } } if(s[80]!=0){ cout<<"overflow"<<endl; }else{ bool flag=false; for(int i=79; i>=0; i--){ if(flag==true || s[i]!=0){ flag=true; cout<<s[i]; } } cout<<endl; } }
a.cc:4:11: error: 'string' was not declared in this scope 4 | int get80(string str, int* num); | ^~~~~~ a.cc:1:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' +++ |+#include <string> 1 | using namespace std; a.cc:4:23: error: expected primary-expression before 'int' 4 | int get80(string str, int* num); | ^~~ a.cc:4:31: error: expression list treated as compound expression in initializer [-fpermissive] 4 | int get80(string str, int* num); | ^ a.cc: In function 'int main()': a.cc:7:9: error: 'string' was not declared in this scope 7 | string a80, b80; | ^~~~~~ a.cc:7:9: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:10:9: error: 'cin' was not declared in this scope 10 | cin>>N; | ^~~ a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' +++ |+#include <iostream> 1 | using namespace std; a.cc:13:22: error: 'a80' was not declared in this scope 13 | cin>>a80; | ^~~ a.cc:14:22: error: 'b80' was not declared in this scope 14 | cin>>b80; | ^~~ a.cc:15:25: error: 'get80' cannot be used as a function 15 | if(get80(a80, a)<0 || get80(b80, b)<0){ | ~~~~~^~~~~~~~ a.cc:15:44: error: 'get80' cannot be used as a function 15 | if(get80(a80, a)<0 || get80(b80, b)<0){ | ~~~~~^~~~~~~~ a.cc:16:25: error: 'cout' was not declared in this scope 16 | cout<<"overflow"<<endl; | ^~~~ a.cc:16:25: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:16:43: error: 'endl' was not declared in this scope 16 | cout<<"overflow"<<endl; | ^~~~ a.cc:1:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' +++ |+#include <ostream> 1 | using namespace std; a.cc: At global scope: a.cc:25:5: error: redefinition of 'int get80' 25 | int get80(string str, int* num){ | ^~~~~ a.cc:4:5: note: 'int get80' previously defined here 4 | int get80(string str, int* num); | ^~~~~ a.cc:25:11: error: 'string' was not declared in this scope 25 | int get80(string str, int* num){ | ^~~~~~ a.cc:25:11: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>' a.cc:25:23: error: expected primary-expression before 'int' 25 | int get80(string str, int* num){ | ^~~ a.cc: In function 'void sum80(int*, int*)': a.cc:53:17: error: 'cout' was not declared in this scope 53 | cout<<"overflow"<<endl; | ^~~~ a.cc:53:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:53:35: error: 'endl' was not declared in this scope 53 | cout<<"overflow"<<endl; | ^~~~ a.cc:53:35: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>' a.cc:59:33: error: 'cout' was not declared in this scope 59 | cout<<s[i]; | ^~~~ a.cc:59:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:62:17: error: 'cout' was not declared in this scope 62 | cout<<endl; | ^~~~ a.cc:62:17: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>' a.cc:62:23: error: 'endl' was not declared in this scope 62 | cout<<endl; | ^~~~ a.cc:62:23: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
s611485909
p00015
C++
#include <iostream> #include <string> using namespace std; int main () { int n; string a, b; cin >> n; for(int i=0;i<n;i++){ int x[81]={0}, y[81]={0}, z[81]={0}; cin >> a; cin >> b; reverse(a.begin(), a.end()); reverse(b.begin(), b.end()); for(int j=0;j<a.size();j++){ x[j]=a[j]-'0'; } for(int j=0;j<b.size();j++){ y[j]=b[j]-'0'; } for(int j=0;j<80;j++){ z[j]+=x[j]+y[j]; if(z[j]>=10){ z[j+1]=1; z[j]-=10; } } if(z[80]>0){ cout << "overflow" <<endl; }else{ bool flag = 0; for(int j=79;j>=0;j--){ if(z[j]==0 && flag==0){ continue; }else{ flag=1; } cout<<z[j]; } if(flag==0){ cout<<0; } cout<<endl; } } return 0; }
a.cc: In function 'int main()': a.cc:17:9: error: 'reverse' was not declared in this scope 17 | reverse(a.begin(), a.end()); | ^~~~~~~
s063682884
p00016
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { private static final String REGIX_COMMA = ","; private static final int MAX_ANGLE = 180; private static final String EOF = "0,0"; public static void main(String[] args) { try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String input = null; double x = 0; double y = 0; int angle = 90; while ((input = in.readLine()) != null && !EOF.equals(input)) { String[] data = input.split(REGIX_COMMA); int length = Integer.valueOf(data[0]); x += length * Math.cos(Math.toRadians(Integer.valueOf(angle))); y += length * Math.sin(Math.toRadians(Integer.valueOf(angle))); angle -= Integer.valueOf(data[1]); } System.out.println((int)x); System.out.println((int)y); } catch (IOException e) { e.printStackTrace(); } finally { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } } }
Main.java:36: error: cannot find symbol in.close(); ^ symbol: variable in location: class Main 1 error
s852881857
p00016
Java
import java.util.Scanner; import java.math.BigDecimal; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); double x=0; double y=0; double rad=Math.PI/2; while(sc.hasNext()){ String[] s=sc.next().split(","); int dis=Integer.parseInt(s[0]); x+=dis*Math.cos(rad); y+=dis*Math.sin(rad); int deg=Integer.parseInt(s[1]); rad-=Math.toRadians(deg); } BigDecimal a=new BigDecimal(x); BigDecimal b=new BigDecimal(y); x=x.setScale(0,ROUND_DOWN); y=y.setScale(0,ROUND_DOWN); System.out.println(x); System.out.println(y); } }
Main.java:20: error: cannot find symbol x=x.setScale(0,ROUND_DOWN); ^ symbol: variable ROUND_DOWN location: class Main Main.java:20: error: double cannot be dereferenced x=x.setScale(0,ROUND_DOWN); ^ Main.java:21: error: cannot find symbol y=y.setScale(0,ROUND_DOWN); ^ symbol: variable ROUND_DOWN location: class Main Main.java:21: error: double cannot be dereferenced y=y.setScale(0,ROUND_DOWN); ^ 4 errors
s450793031
p00016
Java
import java.util.Scanner; import java.math.BigDecimal; class Main{ public static void main(String[] args){ Scanner sc=new Scanner(System.in); double x=0; double y=0; double rad=Math.PI/2; while(sc.hasNext()){ String[] s=sc.next().split(","); int dis=Integer.parseInt(s[0]); x+=dis*Math.cos(rad); y+=dis*Math.sin(rad); int deg=Integer.parseInt(s[1]); rad-=Math.toRadians(deg); } BigDecimal a=new BigDecimal(x); BigDecimal b=new BigDecimal(y); x=x.setScale(0,BigDecimal.ROUND_DOWN); y=y.setScale(0,BigDecimal.ROUND_DOWN); System.out.println(x); System.out.println(y); } }
Main.java:20: error: double cannot be dereferenced x=x.setScale(0,BigDecimal.ROUND_DOWN); ^ Main.java:21: error: double cannot be dereferenced y=y.setScale(0,BigDecimal.ROUND_DOWN); ^ Note: Main.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. 2 errors
s608532207
p00016
Java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class gettrezya { public static void main(String[] aegs){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int a = 0,c=0; String t = ""; double counta =0,countb = 0; double rad = 90.0; double PI = Math.PI; while(true){ try { t = br.readLine(); } catch (IOException e) { // TODO 自動生成された catch ブロック e.printStackTrace(); } String[] tt = t.split(",",0); a = Integer.parseInt(tt[0]); c = Integer.parseInt(tt[1]); if(a == 0 && c == 0){ break; } System.out.println(rad); counta += (a * Math.sin(rad*PI/180d)); countb += (a * Math.cos(rad*PI/180d)); rad = rad - c; } System.out.println((int)countb); System.out.println((int)counta); } }
Main.java:6: error: class gettrezya is public, should be declared in a file named gettrezya.java public class gettrezya { ^ 1 error
s331403452
p00016
Java
import java.util.Scanner; class Main { private static final Scanner scan = new Scanner(System.in) .useDelimiter("[ \t\n,]"); public static void main(String[] args){ double x = 0; double y = 0; int ang = 90; for(;;){ int d = scan.nextInt(); int a = scan.nextInt(); if(d == 0 && a == 0) break; x += d * Math.cos(Math.toRadians((double) ang); y += d * Math.sin(Math.toRadians((double) ang); ang -= a; } System.out.println((int)(x)); System.out.println((int)(y)); } }
Main.java:16: error: ')' or ',' expected x += d * Math.cos(Math.toRadians((double) ang); ^ Main.java:17: error: ')' or ',' expected y += d * Math.sin(Math.toRadians((double) ang); ^ 2 errors
s110077376
p00016
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in); public static void main(String[] args){ int ang = 90; for(;;){ int d = scan.nextInt(); int a = scan.nextInt(); if(d == 0 && a == 0){ break; } double x = (double) d * Math.cos(Math.toRadians((double) ang)); double y = (double) d * Math.sin(Math.toRadians((double) ang)); } System.out.printf("%d\n", (int) x); System.out.printf("%d\n", (int) y); } }
Main.java:18: error: cannot find symbol System.out.printf("%d\n", (int) x); ^ symbol: variable x location: class Main Main.java:19: error: cannot find symbol System.out.printf("%d\n", (int) y); ^ symbol: variable y location: class Main 2 errors
s704867690
p00016
Java
import java.util.*; public class Main{ private static final Scanner scan = new Scanner(System.in).useDelimiter("[ \t\n,]); public static void main(String[] args){ double x = 0; double y = 0; int ang = 90; for(;;){ int d = scan.nextInt(); int a = scan.nextInt(); if(d == 0 && a == 0){ break; } x = (double) d * Math.cos(Math.toRadians((double) ang)); y = (double) d * Math.sin(Math.toRadians((double) ang)); } System.out.printf("%d\n", (int) x); System.out.printf("%d\n", (int) y); } }
Main.java:4: error: unclosed string literal private static final Scanner scan = new Scanner(System.in).useDelimiter("[ \t\n,]); ^ 1 error
s480429658
p00016
Java
import java.util.*; public class Main2{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); double x = 0.0; double y = 0.0; double angle = 0.0; while(sc.hasNext()){ String[] line = (sc.next()).split(","); int step = Integer.parseInt(line[0]); int dir = Integer.parseInt(line[1]); if(step==0 && dir==0)break; x += (double)step * Math.sin(Math.toRadians(angle)); y += (double)step * Math.cos(Math.toRadians(angle)); angle += (double)dir; } System.out.println((int)x); System.out.println((int)y); } }
Main.java:3: error: class Main2 is public, should be declared in a file named Main2.java public class Main2{ ^ 1 error
s566385496
p00016
C
#incl ude <stdio.h> #include <math.h> #define PI 3.141592 int main(void) { int angle = 0; double x = 0, y = 0; double rad; int step, rotate; scanf("%d,%d", &step, &rotate); while (step != 0 || rotate != 0) { rad = (double)(angle % 90) * PI / 180.0; if( angle == 0) y += (double)step; else if( angle < 90) { x += (double)step * sin(rad); y += (double)step * cos(rad); } else if( angle == 90) x += (double)step; else if( angle < 180) { x += (double)step * cos(rad); y -= (double)step * sin(rad); } else if( angle == 180) y -= (double)step; else if( angle < 270) { x -= (double)step * sin(rad);; y -= (double)step * cos(rad); } else if( angle == 270) x -= (double)step; else if( angle < 360) { x -= (double)step * cos(rad); y += (double)step * sin(rad); } if( (angle = (angle + rotate) % 360) < 0) angle = 360 + angle; scanf("%d,%d", &step, &rotate); } printf("%d\n\d\n", (int)x, (int)y); return 0; }
main.c:1:2: error: invalid preprocessing directive #incl; did you mean #include? 1 | #incl ude <stdio.h> | ^~~~ | include main.c: In function 'main': main.c:11:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf' 2 | #include <math.h> +++ |+#include <stdio.h> 3 | main.c:11:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:44:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 44 | printf("%d\n\d\n", (int)x, (int)y); | ^~~~~~ main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:26: warning: unknown escape sequence: '\d' 44 | printf("%d\n\d\n", (int)x, (int)y); | ^
s822657593
p00016
C
#incl ude <stdio.h> #include <math.h> #define PI 3.141592 int main(void) { int angle = 0; double x = 0, y = 0; double rad; int step, rotate; scanf("%d,%d", &step, &rotate); while (step != 0 || rotate != 0) { rad = (double)(angle % 90) * PI / 180.0; if( angle == 0) y += (double)step; else if( angle < 90) { x += (double)step * sin(rad); y += (double)step * cos(rad); } else if( angle == 90) x += (double)step; else if( angle < 180) { x += (double)step * cos(rad); y -= (double)step * sin(rad); } else if( angle == 180) y -= (double)step; else if( angle < 270) { x -= (double)step * sin(rad);; y -= (double)step * cos(rad); } else if( angle == 270) x -= (double)step; else if( angle < 360) { x -= (double)step * cos(rad); y += (double)step * sin(rad); } if( (angle = (angle + rotate) % 360) < 0) angle = 360 + angle; scanf("%d,%d", &step, &rotate); } printf("%d\n\d\n", (int)x, (int)y); return 0; }
main.c:1:2: error: invalid preprocessing directive #incl; did you mean #include? 1 | #incl ude <stdio.h> | ^~~~ | include main.c: In function 'main': main.c:11:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf' 2 | #include <math.h> +++ |+#include <stdio.h> 3 | main.c:11:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:44:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 44 | printf("%d\n\d\n", (int)x, (int)y); | ^~~~~~ main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:26: warning: unknown escape sequence: '\d' 44 | printf("%d\n\d\n", (int)x, (int)y); | ^
s502516786
p00016
C
#incl ude <stdio.h> #include <math.h> #define PI 3.141592 int main(void) { int angle = 0; double x = 0.0, y = 0.0; double rad; int step, rotate; scanf("%d,%d", &step, &rotate); while (step != 0 || rotate != 0) { rad = (double)(angle % 90) * PI / 180.0; if( angle == 0) y += (double)step; else if( angle < 90) { x += (double)step * sin(rad); y += (double)step * cos(rad); } else if( angle == 90) x += (double)step; else if( angle < 180) { x += (double)step * cos(rad); y -= (double)step * sin(rad); } else if( angle == 180) y -= (double)step; else if( angle < 270) { x -= (double)step * sin(rad);; y -= (double)step * cos(rad); } else if( angle == 270) x -= (double)step; else if( angle < 360) { x -= (double)step * cos(rad); y += (double)step * sin(rad); } if( (angle = (angle + rotate) % 360) < 0) angle = 360 + angle; scanf("%d,%d", &step, &rotate); } printf("%d\n\d\n", (int)x, (int)y); return 0; }
main.c:1:2: error: invalid preprocessing directive #incl; did you mean #include? 1 | #incl ude <stdio.h> | ^~~~ | include main.c: In function 'main': main.c:11:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf' 2 | #include <math.h> +++ |+#include <stdio.h> 3 | main.c:11:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 11 | scanf("%d,%d", &step, &rotate); | ^~~~~ main.c:11:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:44:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 44 | printf("%d\n\d\n", (int)x, (int)y); | ^~~~~~ main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:44:9: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:44:26: warning: unknown escape sequence: '\d' 44 | printf("%d\n\d\n", (int)x, (int)y); | ^
s961944306
p00016
C
#include<stdio.h> #define _USE_MATH_DEFINES #include <math.h> int main(void) { double x = 0, y = 0; while (1) { double arg2 = M_PI / 180.0; int arg1 = 90; int Arg = 0, Len = 0; scanf("%d,%d", &Len, &Arg); if (Len == 0 && Arg == 0) { break; } else { arg1 -= Arg; arg2 += (arg1 % 360)*M_PI / 180.0; x += cos(arg2)*Len; y += sin(arg2)*Len; ????????????????????????????????????continue; } } printf("%d\n%d\n", (int)x, (int)y); return 0; }
main.c: In function 'main': main.c:20:1: error: expected expression before '?' token 20 | ????????????????????????????????????continue; | ^
s061667375
p00016
C
#include<stdio.h> #define _USE_MATH_DEFINES #include <math.h> int main(void) { double x = 0, y = 0; while (1) { double arg2 = M_PI / 180.0; int arg1 = 90; int Arg = 0, Len = 0; scanf("%d,%d", &Len, &Arg); if (Len == 0 && Arg == 0) { break; } else { arg1 -= Arg; arg2 += (arg1 % 360)*M_PI / 180.0; x += cos(arg2)*Len; y += sin(arg2)*Len; ????????????????????????????????? } } printf("%d\n%d\n", (int)x, (int)y); return 0; }
main.c: In function 'main': main.c:20:1: error: expected expression before '?' token 20 | ????????????????????????????????? | ^
s051708833
p00016
C
#include<stdio.h> #define _USE_MATH_DEFINES #include <math.h> int main(void) { while (1) { double x = 0, y = 0; double arg2 = 0; int arg1 = 90; int Arg = 0, Len = 0; scanf("%d,%d", &Len, &Arg); if (Len == 0 && Arg == 0) { break; } else { arg1 -= Arg; arg2 += (arg1 % 360)*M_PI / 180.0; x += cos(arg2)*Len; y += sin(arg2)*Len; } } printf("%d\n%d\n", (int)x, (int)y); return 0; }
main.c: In function 'main': main.c:22:33: error: 'x' undeclared (first use in this function) 22 | printf("%d\n%d\n", (int)x, (int)y); | ^ main.c:22:33: note: each undeclared identifier is reported only once for each function it appears in main.c:22:41: error: 'y' undeclared (first use in this function); did you mean 'yn'? 22 | printf("%d\n%d\n", (int)x, (int)y); | ^ | yn
s046210040
p00016
C
#include <stdio.h> #include <math.h> int main(int argc,char* argv[]){ double x,y; double rad; int run; int shita; x = y = 0; rad = m_PI / 2; for(;;){ scanf("%d,%d",&run,&shita); if(run == 0 && shita == 0){ break; } x += cos(rad) * run; y += sin(rad) * run; rad -= shita / 180.0 * m_PI; } modf(x, &x); modf(y, &y); printf("%.0lf\n%.0lf\n",x,y); return 0; }
main.c: In function 'main': main.c:10:9: error: 'm_PI' undeclared (first use in this function); did you mean 'M_PI'? 10 | rad = m_PI / 2; | ^~~~ | M_PI main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in
s771003371
p00016
C
#include<iostream> #include<math.h> #define PI 3.14159265359 using namespace std; int main(){ int n,r; char c; double nx=0,ny=0; int nr=90; while(cin>>n>>c>>r &&n+r){ nx+=cos(nr*PI/180.0)*n; ny+=sin(nr*PI/180.0)*n; nr+=-1*r; } cout<<(int)nx<<endl<<(int)ny<<endl; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s076912952
p00016
C
#include<iostream> #include<math.h> #define PI 3.14159265359 using namespace std; int main(){ int n,r; char c; double nx=0,ny=0; int nr=90; while(cin>>n>>c>>r &&n+r){ nx+=cos(nr*PI/180.0)*n; ny+=sin(nr*PI/180.0)*n; nr+=-1*r; } cout<<(int)nx<<endl<<(int)ny<<endl; }
main.c:1:9: fatal error: iostream: No such file or directory 1 | #include<iostream> | ^~~~~~~~~~ compilation terminated.
s863671793
p00016
C
#include "stdafx.h" #include <math.h> /* cos */ double last_turn; #define PI 3.14159265 double walk(double go,double turn,double* x,double* y) { *x -= go * sin(last_turn* PI / 180.0); *y += go * cos(last_turn* PI / 180.0); return -turn; } int main(void) { double gx = 0,gy = 0,now_x = 0, now_y = 0; double go = 0, turn = 0; last_turn = 0; now_x = 0, now_y = 0; for(;;){ go = 0, turn = 0; scanf("%lf,%lf",&go,&turn); last_turn += walk(go,turn,&now_x,&now_y); if(go==0 && turn==0) break; } printf("%d\n%d\n",(int)now_x,(int)now_y); return 0; }
main.c:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s893250837
p00016
C
#include "stdafx.h" #include <math.h> /* cos */ double last_turn; #define PI 3.14159265 double walk(double go,double turn,double* x,double* y) { *x -= go * sin(last_turn* PI / 180.0); *y += go * cos(last_turn* PI / 180.0); return -turn; } int main() { double gx = 0,gy = 0,now_x = 0, now_y = 0; double go = 0, turn = 0; last_turn = 0; now_x = 0, now_y = 0; for(;;){ go = 0, turn = 0; scanf("%lf,%lf",&go,&turn); last_turn += walk(go,turn,&now_x,&now_y); if(go==0 && turn==0) break; } printf("%d\n%d\n",(int)now_x,(int)now_y); return 0; }
main.c:1:10: fatal error: stdafx.h: No such file or directory 1 | #include "stdafx.h" | ^~~~~~~~~~ compilation terminated.
s602632472
p00016
C
#include <stdio.h> #include <math.h> #define PI 3.141592653589 int main() { double x = 0, y = 0, angle = 90; double d, a; while (1) { scanf("%f,%f", &d, &a); if (d == 0 && a == 0) break; x += cos(angle * PI / 180.0) * d; y += sin(angle * PI / 180.0) * d; angle -= a; } printf("%d\n%d\n", int(x), int(y)); return 0; }
main.c: In function 'main': main.c:22:22: error: expected expression before 'int' 22 | printf("%d\n%d\n", int(x), int(y)); | ^~~
s708501427
p00016
C
#include <stdio.h> #include <math.h> int main(void) { double x, y, r; double d, a; x = y = 0.0; r = 90.0; while (true){ scanf("%lf,%lf", &d, &a); if (d == 0.0 && a == 0.0){ break; } x += cos(r / 180 * M_PI) * d; y += sin(r / 180 * M_PI) * d; r -= a; } printf("%d\n%d\n", (int)x, (int)y); return (0); }
main.c: In function 'main': main.c:11:10: error: 'true' undeclared (first use in this function) 11 | while (true){ | ^~~~ main.c:3:1: note: 'true' is defined in header '<stdbool.h>'; this is probably fixable by adding '#include <stdbool.h>' 2 | #include <math.h> +++ |+#include <stdbool.h> 3 | main.c:11:10: note: each undeclared identifier is reported only once for each function it appears in 11 | while (true){ | ^~~~
s491387768
p00016
C
#include<stdio.h> int main(){ int angle=90,m,n; double x=0,y=0; while(scanf("%d,%d",&m,&n),m||n){ x+=m*cos(pai*angle/180); y+=m*sin(pai*angle/180); angle=(angle-n)%360; } printf("%d\n%d\n",(int)x,(int)y); return 0; }
main.c: In function 'main': main.c:6:6: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration] 6 | x+=m*cos(pai*angle/180); | ^~~ main.c:2:1: note: include '<math.h>' or provide a declaration of 'cos' 1 | #include<stdio.h> +++ |+#include <math.h> 2 | int main(){ main.c:6:6: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch] 6 | x+=m*cos(pai*angle/180); | ^~~ main.c:6:6: note: include '<math.h>' or provide a declaration of 'cos' main.c:6:10: error: 'pai' undeclared (first use in this function) 6 | x+=m*cos(pai*angle/180); | ^~~ main.c:6:10: note: each undeclared identifier is reported only once for each function it appears in main.c:7:6: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 7 | y+=m*sin(pai*angle/180); | ^~~ main.c:7:6: note: include '<math.h>' or provide a declaration of 'sin' main.c:7:6: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] main.c:7:6: note: include '<math.h>' or provide a declaration of 'sin'
s567492626
p00016
C
d; double x,y,c; main(s) { for(;~scanf("%d,%d",&s,&d);c+=d*M_PI/180) x+=s*sin(c),y+=s*cos(c); exit(!printf("%d\n%d\n",d=x,s=y)); }
main.c:1:1: warning: data definition has no type or storage class 1 | d; | ^ main.c:1:1: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:3:1: error: return type defaults to 'int' [-Wimplicit-int] 3 | main(s) | ^~~~ main.c: In function 'main': main.c:3:1: error: type of 's' defaults to 'int' [-Wimplicit-int] main.c:5:15: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 5 | for(;~scanf("%d,%d",&s,&d);c+=d*M_PI/180) | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | d; main.c:5:15: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 5 | for(;~scanf("%d,%d",&s,&d);c+=d*M_PI/180) | ^~~~~ main.c:5:15: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:5:41: error: 'M_PI' undeclared (first use in this function) 5 | for(;~scanf("%d,%d",&s,&d);c+=d*M_PI/180) | ^~~~ main.c:5:41: note: each undeclared identifier is reported only once for each function it appears in main.c:6:22: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 6 | x+=s*sin(c),y+=s*cos(c); | ^~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'sin' +++ |+#include <math.h> 1 | d; main.c:6:22: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] 6 | x+=s*sin(c),y+=s*cos(c); | ^~~ main.c:6:22: note: include '<math.h>' or provide a declaration of 'sin' main.c:6:34: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration] 6 | x+=s*sin(c),y+=s*cos(c); | ^~~ main.c:6:34: note: include '<math.h>' or provide a declaration of 'cos' main.c:6:34: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch] main.c:6:34: note: include '<math.h>' or provide a declaration of 'cos' main.c:7:9: error: implicit declaration of function 'exit' [-Wimplicit-function-declaration] 7 | exit(!printf("%d\n%d\n",d=x,s=y)); | ^~~~ main.c:1:1: note: include '<stdlib.h>' or provide a declaration of 'exit' +++ |+#include <stdlib.h> 1 | d; main.c:7:9: warning: incompatible implicit declaration of built-in function 'exit' [-Wbuiltin-declaration-mismatch] 7 | exit(!printf("%d\n%d\n",d=x,s=y)); | ^~~~ main.c:7:9: note: include '<stdlib.h>' or provide a declaration of 'exit' main.c:7:15: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 7 | exit(!printf("%d\n%d\n",d=x,s=y)); | ^~~~~~ main.c:7:15: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:7:15: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:7:15: note: include '<stdio.h>' or provide a declaration of 'printf'
s050510484
p00016
C
#include <stdio.h> int main(void){ float d , r , x = 0 , y = 0 , r_now = 90; while(1){ scanf("%f,%f" , &d , &r); if(d==0&&r==0) break; x += d * cos(r_now * M_PI / 180); y += d * sin(r_now * M_PI / 180); r_now -= r; } printf("%d\n%d\n" , (int)x , (int)y); return 0; }
main.c: In function 'main': main.c:8:26: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration] 8 | x += d * cos(r_now * M_PI / 180); | ^~~ main.c:2:1: note: include '<math.h>' or provide a declaration of 'cos' 1 | #include <stdio.h> +++ |+#include <math.h> 2 | main.c:8:26: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch] 8 | x += d * cos(r_now * M_PI / 180); | ^~~ main.c:8:26: note: include '<math.h>' or provide a declaration of 'cos' main.c:8:38: error: 'M_PI' undeclared (first use in this function) 8 | x += d * cos(r_now * M_PI / 180); | ^~~~ main.c:8:38: note: each undeclared identifier is reported only once for each function it appears in main.c:9:26: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 9 | y += d * sin(r_now * M_PI / 180); | ^~~ main.c:9:26: note: include '<math.h>' or provide a declaration of 'sin' main.c:9:26: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] main.c:9:26: note: include '<math.h>' or provide a declaration of 'sin'
s204221593
p00016
C
#include <stdio.h> #include <math.h> int main(){ int dist, rad; int rad_amount; double x, y; int a, b; double TRANS=3.14159/180.0; x=0.0; y=0.0; rad_amount=0; while(1){ scanf("%d,%d", &dist, &rad); if(dist==0 && rad==0) break; x+=(double)dist*sin((double)rad_amount*TRANS); y+=(double)dist*cos((double)rad_amount*TRANS); rad_amount+=rad; if(rad_amount>180) rad_amount-=360; if(rad_amount<-180) rad_amount+=360; } printf("%.0lf\n%.0lf\n", x-floor(0.5), ‚™-floor(0.5)); return 0; }
main.c: In function 'main': main.c:21:42: error: stray '\302' in program 21 | printf("%.0lf\n%.0lf\n", x-floor(0.5), <U+0082><U+0099>-floor(0.5)); | ^~~~~~~~ main.c:21:43: error: stray '\302' in program 21 | printf("%.0lf\n%.0lf\n", x-floor(0.5), <U+0082><U+0099>-floor(0.5)); | ^~~~~~~~
s457708255
p00016
C
float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););}
main.c:1:13: warning: data definition has no type or storage class 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^ main.c:1:13: error: type defaults to 'int' in declaration of 'd' [-Wimplicit-int] main.c:1:15: error: return type defaults to 'int' [-Wimplicit-int] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~~ main.c: In function 'main': main.c:1:15: error: type of 'r' defaults to 'int' [-Wimplicit-int] main.c:1:29: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~~~ main.c:1:1: note: include '<stdio.h>' or provide a declaration of 'scanf' +++ |+#include <stdio.h> 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} main.c:1:29: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~~~ main.c:1:29: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:1:55: error: implicit declaration of function 'cos' [-Wimplicit-function-declaration] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~ main.c:1:1: note: include '<math.h>' or provide a declaration of 'cos' +++ |+#include <math.h> 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} main.c:1:55: warning: incompatible implicit declaration of built-in function 'cos' [-Wbuiltin-declaration-mismatch] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~ main.c:1:55: note: include '<math.h>' or provide a declaration of 'cos' main.c:1:67: error: implicit declaration of function 'sin' [-Wimplicit-function-declaration] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~ main.c:1:67: note: include '<math.h>' or provide a declaration of 'sin' main.c:1:67: warning: incompatible implicit declaration of built-in function 'sin' [-Wbuiltin-declaration-mismatch] main.c:1:67: note: include '<math.h>' or provide a declaration of 'sin' main.c:1:87: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^~~~~~ main.c:1:87: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:87: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:1:87: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:1:85: error: lvalue required as left operand of assignment 1 | float x,y,t;d;main(r){for(;~scanf("%d,%d",&r,&d)?y+=r*cos(t),x-=r*sin(t),t-=d/57.3:d=!printf("%d\n%d\n",d=x,d=y););} | ^
s210871546
p00016
C
include <stdio.h> #include <math.h> #define PI 3.141592 int main(){ int a,b; double v=.0,x=.0,y=.0; while(scanf("%d,%d",&a,&b)){ if(a==0 && b==0)break; x+=sin(v*PI/180)*a; y+=cos(v*PI/180)*a; v+=b; } printf("%.0f\n%.0f\n",x,y); return 0; }
main.c:1:9: error: expected '=', ',', ';', 'asm' or '__attribute__' before '<' token 1 | include <stdio.h> | ^ main.c: In function 'main': main.c:9:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration] 9 | while(scanf("%d,%d",&a,&b)){ | ^~~~~ main.c:3:1: note: include '<stdio.h>' or provide a declaration of 'scanf' 2 | #include <math.h> +++ |+#include <stdio.h> 3 | main.c:9:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch] 9 | while(scanf("%d,%d",&a,&b)){ | ^~~~~ main.c:9:9: note: include '<stdio.h>' or provide a declaration of 'scanf' main.c:15:3: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration] 15 | printf("%.0f\n%.0f\n",x,y); | ^~~~~~ main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf' main.c:15:3: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch] main.c:15:3: note: include '<stdio.h>' or provide a declaration of 'printf'
s466268573
p00016
C
#include<stdio.h> #include<math.h> #define PI 3.141592 int main() { int a,b; double x=0,y=0,r=90; while(scanf("%d,%d",&a,&b) && a || b) { y+=a*sin((r/180)*PI); x+=a*cos((r/180)*PI); r-=b; } printf("%.0lf\n%.0lf",x,y);     return 0; }
main.c: In function 'main': main.c:15:1: error: stray '\343' in program 15 | <U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:15:3: error: stray '\343' in program 15 | <U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:15:5: error: stray '\343' in program 15 | <U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~ main.c:15:7: error: stray '\343' in program 15 | <U+3000><U+3000><U+3000><U+3000>return 0; | ^~~~~~~~
s406492170
p00016
C
#include<stdio.h> #include<math.h> #define PAI 3.141592 int main() { double hos,x=0.0,y=0.0; double rad[2]={90.0}; char c; while(1) { scanf("%lf,%lf",&hos,rad+1); if(hos==0.0 && rad==0.0) break; x+=hos*cos(rad[0]*PAI/180.0); y+=hos*sin(rad[0]*PAI/180.0); rad[0]-=rad[1]; } printf("%d\n%d\n",(int)x,(int)y); return 0; }
main.c: In function 'main': main.c:14:35: error: invalid operands to binary == (have 'double *' and 'double') 14 | if(hos==0.0 && rad==0.0) | ~~ ^~ | | | double *
s678688740
p00016
C
#include <stdio.h> #include <math.h> int main() { int r,p; double x,y; scanf("%d,%d",&r,&p); y=r; t=p; while(1){ scanf("%d,%d",&r,&p); if(r==0&&p==0) break; y+=r*sin(M_PI_2 - t*M_PI/180); x+=r*cos(M_PI_2 - t*M_PI/180); t=p; } printf("%d\n%d\n",(int)x,(int)y) return 0; }
main.c: In function 'main': main.c:9:9: error: 't' undeclared (first use in this function) 9 | t=p; | ^ main.c:9:9: note: each undeclared identifier is reported only once for each function it appears in main.c:17:41: error: expected ';' before 'return' 17 | printf("%d\n%d\n",(int)x,(int)y) | ^ | ; 18 | return 0; | ~~~~~~
s707685353
p00016
C
#include <stdio.h> #include <math.h> int main(){ int n,m; int x,y; x = y = 0; for(;;){ scanf("%d,%d" ,&n ,&m); if(n == 0 && m == 0) break; x += n*cos(m); y += n*sin(m); } printf("%d\n%d\n ,x ,y); return 0; }
main.c: In function 'main': main.c:19:10: warning: missing terminating " character 19 | printf("%d\n%d\n ,x ,y); | ^ main.c:19:10: error: missing terminating " character 19 | printf("%d\n%d\n ,x ,y); | ^~~~~~~~~~~~~~~~~ main.c:21:3: error: expected expression before 'return' 21 | return 0; | ^~~~~~ main.c:21:12: error: expected ';' before '}' token 21 | return 0; | ^ | ; 22 | } | ~
s577954285
p00016
C
#include<stdio.h> #include<math.h> int main(void) { double a,b,c=0; double x=0.0,y=0.0; for(;;){ scanf(''%lf,%lf'',&a,&c); if(a==0||c==0) break; b+=c; b=b*M_PAI/180; x+=a*cos(b); y+=a*sin(b); } printf(''%f %f\n'',x,y); return 0; }
main.c: In function 'main': main.c:9:11: error: empty character constant 9 | scanf(''%lf,%lf'',&a,&c); | ^~ main.c:9:14: error: 'lf' undeclared (first use in this function) 9 | scanf(''%lf,%lf'',&a,&c); | ^~ main.c:9:14: note: each undeclared identifier is reported only once for each function it appears in main.c:9:17: error: expected expression before '%' token 9 | scanf(''%lf,%lf'',&a,&c); | ^ main.c:9:20: error: empty character constant 9 | scanf(''%lf,%lf'',&a,&c); | ^~ main.c:13:9: error: 'M_PAI' undeclared (first use in this function); did you mean 'M_PI'? 13 | b=b*M_PAI/180; | ^~~~~ | M_PI main.c:18:10: error: empty character constant 18 | printf(''%f %f\n'',x,y); | ^~ main.c:18:13: error: 'f' undeclared (first use in this function) 18 | printf(''%f %f\n'',x,y); | ^ main.c:18:17: error: stray '\' in program 18 | printf(''%f %f\n'',x,y); | ^ main.c:18:17: error: expected ')' before 'n' 18 | printf(''%f %f\n'',x,y); | ~ ^~ | ) main.c:18:19: error: empty character constant 18 | printf(''%f %f\n'',x,y); | ^~
s722193320
p00016
C
#include<stdio.h> #include<math.h> int main(void) { double a,b,c=0; double x=0.0,y=0.0; for(;;){ scanf("%lf,%lf",&a,&c); if(a==0||c==0) break; b+=c; b=b*M_PAI/180; x+=a*cos(b); y+=a*sin(b); } printf("%f %f\n",x,y); return 0; }
main.c: In function 'main': main.c:13:9: error: 'M_PAI' undeclared (first use in this function); did you mean 'M_PI'? 13 | b=b*M_PAI/180; | ^~~~~ | M_PI main.c:13:9: note: each undeclared identifier is reported only once for each function it appears in