xiangel's blog

By xiangel, history, 7 years ago, In English

I can't check AC codes, and I can't check the wrong case in my own WA code either.

This round is not a GYM round, so why I'm forbidden to check those stuffs?

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By xiangel, 10 years ago, In English

The problem is http://codeforces.net/gym/100519/problem/I.

The problem request you to guess a prime P, P is less than or equals to N, and N is the first line in a test case.

Your program should make some guesses and the judge will return a answer string when your program do that. It confused me on the I/O.

Here are my two different codes:

while (cin >> n) {
    do {
        cout << my guess number << endl;
        cin >> ans;                  // ans is answer string
        do something.
    } while (it should keep going);
    if (ans[0] == 'O')               // means the answer string is "OK"
        continue;
    get the P.
    cout << P << endl;
    cin >> ans;                      // it will always return "OK" when you guess is current
}
while (scanf("%d", &n) != EOF) {
    do {
        printf("%d\n", my guess number);
        scanf("%s", ans);            // ans is answer string
        do something.
    } while (it should keep going); 
    if (ans[0] == 'O')               // means the answer string is "OK"
        continue;
    get the P.
    printf("%d\n", P);
    scanf("%s", ans);                // it will always return "OK" when you guess is current
}

The first one get Ac, and the second one get "Idleness limit exceeded".

Could anyone help me?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it