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

C++ solution!
Posted by yaho0o0 10 Apr 2009 22:28
#include <iostream>
using namespace std;
int main()
{
    unsigned long long n,m;
    cin>>n>>m;
    if(m>=n) cout<<2*(n-1)<<endl;
    if(n>m) cout <<2*(m-1)+1<<endl;
return 0;
}
Re: C++ solution!
Posted by zxy_snow 1 Jun 2011 07:15
Orz...My solution is so complex...
Re: C++ solution!
Posted by saibogo 28 Jun 2012 22:34
You can even simpler))

#include <iostream>
using namespace std;
int main()
{
    unsigned long long iN, iM;
    cin >> iN >> iM;
    cout << min(2 * (iN - 1), 2 * (iM - 1) + 1);
return 0;
}
Re: C++ solution!
Posted by Soucup Adrian 3 Jul 2012 18:39
You don't really need unsigned long long.

Got AC with unsigned int.