|
|
back to boardWA at test#2, please help ! #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; int a; int b; long double c=0; for (unsigned int i = 0; i < n; i++) { cin >> a; cin >> b; if (i != 0 ) { c = c * 10 + a + b; } else c = a + b;
}
cout <<c<< endl; } Re: WA at test#2, please help ! 3 1 1 9 0 9 1 try this this test helped me Re: WA at test#2, please help ! My code's producing 300. It's right, isn't it? Re: WA at test#2, please help ! What is double mantissa size? About 17 decimal digits? What is required number size? About 1,000,000 digits? So, how your solution is supposed to work? Re: WA at test#2, please help ! //wa on test 2 .. whats the problem with my code #include<bits/stdc++.h> using namespace std; int main() { long n,i,j=0; cin>>n; int a[2000003],b=0; string s; n*=2; for(i=0;i<n;i++){ cin>>a[i]; } for(i=n-1;i>=0;i=i-2){ b=(b+a[i]+a[i-1]); s[j]=(b%10)+48; b=b/10; j++; } for(i=j-1;i>=0;i--){ cout<<s[i]; } } |
|
|