spoj.pl/problems/NGM/
my code
#include<iostream> #include<string.h> #include<stdio.h> #include<sstream> using namespace std; int main() {while(1){ long long n,i=0,m=9,j; cin>>n; string mido; while(m!=0) { n--; i++; ostringstream convert; convert << n; mido = convert.str(); for(j=0;j<mido.size();j++) { if(mido[j]=='0') { cout<<"1"<<endl<<i<<endl; m=0; break; } } }} return 0; }
How do you expect your code to terminate? This can't be the code that you submitted.
when i should terminate it
While(1) will never end unless you force it to. This code does not. That's why you're getting a TLE.
yes i know that but in this problem when i should stop taking input
There's only one number in the input file from reading the problem statement.
i made zero but also wa
i found no. is zero or no. more than 2000000
and also wa
and when no.2 win the game i think he won't win at all
I'm sorry. I don't understand what you're trying to say.
If you formulate your ideas a little better I might be able to help you.
i said that it terminates when input is zero
and it gives wa
also i want to know when number 2 when i think he won't win at all (it may be reason for wa)???
There is only one number in the input. Read that number, process it, and terminate.
You only print 2 on the first line of the output If the first player can not guarantee a win with his next move.
plz give test case for no.2 will win the game???
becz no.1 must win all games
234567890
we can subtract 10 so it will be1234567880so it will have zero at end !!!
10 is not a "digit".
oh i understand the digit must from 1 to 9 thx leppy very much u r very clever :mrgreen:
Hello!If I correctly understand problem, answer for sample number 234567890 is:21Right?
No the answer is just: 2
Aah.. really. Thanks! But problem is easier than I supposed..