|  | 
|  | 
| back to board | LOL!!! WA #1 but works correctly on my computer Posted by Son1G  4 Jul 2011 20:12Problem is input of data! How should i fix it?Code:
 #include <iostream>
 #include <cstring>
 #include <string>
 
 using namespace std;
 
 int n, k;
 string s;
 
 int main() {
 cin >> n; cin >> s;
 int i;
 i=0; k=0;
 while(s[i]=='!') {
 k++;
 i++;
 }
 
 long long a, temp;
 
 a=1; i=0;
 if(n%k!=0) {
 while(temp!=n%k) {
 temp=n-i*k;
 a*=temp;
 i++;
 }
 } else
 if(n%k==0) {
 while(temp!=k) {
 temp=n-i*k;
 a*=temp;
 i++;
 }
 }
 
 cout << a << endl;
 
 system("pause");
 return 0;
 }
Re: LOL!!! WA #1 but works correctly on my computer Posted by hatred  9 Jul 2011 21:23try to delete system("pause") may be it puts some text into stdoutRe: LOL!!! WA #1 but works correctly on my computer Posted by Aman  15 Sep 2016 04:54Re: LOL!!! WA #1 but works correctly on my computer > In this program we have to do special handling of big integer variables Are you sure? 20! ~= 2E18 signed long long limit = 2^63-1 ~= 9E18  P.S. Article http://www.techcrashcourse.com/2015/05/c-programming-language-data-types.html  is ... weird. Table is for some 16-bit compiler. Typical compilers now are 32bit - 64bit. No long long at all in the table. Long double - 10 bytes and bigger rabnge or the same range with double so 8 bytes?   Edited by author 15.09.2016 18:57 | 
 | 
|