ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1224. Spiral

it seems the real answer is something different of acceptable answer
Posted by mhg 3 Jul 2014 18:37
hi,
in the acceptable answer the answer of 5 4 is 7 but you can easily understand that the real answer is 6(you can test it by drawing a simple 5 4 table).

here is a sample answer:

#include <iostream>

using namespace std;

int main() {
    int unsigned long long N , M , turn = 0;
 cin >> N >> M;



 while( N > 2 && M > 2){
     turn += 4;
     N -= 2;
     M -= 2;
 }
 if (N == 2 && M > 1 || M == 2 && N > 1)  turn += 2;

 if (M == 1 && N > 1) turn += 1;
  cout << turn << endl;

  system ("PAUSE");
  return 0 ;

}
Re: it seems the real answer is something different of acceptable answer
Posted by Ealham Al Musabbir 5 Jul 2015 05:23
Nope...for 5 4 , answer is 7.
For 4 5, answer is 6.

Edited by author 05.07.2015 11:06

Edited by author 05.07.2015 11:06