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

yaho0o0 C++ solution! [3] // Problem 1224. Spiral 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;
}
zxy_snow Re: C++ solution! [2] // Problem 1224. Spiral 1 Jun 2011 07:15
Orz...My solution is so complex...
saibogo Re: C++ solution! [1] // Problem 1224. Spiral 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;
}
Soucup Adrian Re: C++ solution! // Problem 1224. Spiral 3 Jul 2012 18:39
You don't really need unsigned long long.

Got AC with unsigned int.