Search found 4 matches

by legnaleurc
Sat May 05, 2007 11:30 am
Forum: Volume 107 (10700-10799)
Topic: 10719 - Quotient Polynomial
Replies: 51
Views: 25053

I got it.
Use "while(cin >> k)" instead of "while(!cin.eof())", and I got AC.
Thanks.
by legnaleurc
Tue May 01, 2007 7:41 am
Forum: Volume 103 (10300-10399)
Topic: 10324 - Zeros and Ones
Replies: 179
Views: 66955

I have found why I got TLE.


........blahblahblah
while(!cin.eof())
{
getline(cin, line);
........................blahblahblah


Because the last char. of input file could be space, it won't get EOF
This cause limitless loop

Use while(getline(cin, line)) instead of while(!cin.eof()) and I ...
by legnaleurc
Tue Apr 24, 2007 9:06 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 101748

Well, I used same method(char*) in C and Accepted.
I just wonder about why WA in C++.....
by legnaleurc
Mon Apr 23, 2007 6:12 am
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 101748

I have Accepted with C, but when I try with C++, I got Wrong Answer.

#include <iostream>
#include <string>
using namespace std;

int main()
{
string a,b;
int i,count,len;

while(cin >> a >> b)
{
if(a == "0" && b == "0")
break;
count = 0;
if(a.length() > b.length())
len = b.length ...

Go to advanced search