513A - Game - CodeForces Solution


constructive algorithms math *800

Please click on ads to support us..

Python Code:

s=input()
lst=s.split()
n1=int(lst[0])
n2=int(lst[1])
k1=int(lst[2])
k2=int(lst[3])
if n1>n2:
    print("First")
else:
    print("Second")

C++ Code:

#include<bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<char> vc;
typedef long long ll;
#define sq(a) (a)*(a)
#define pb push_back
#define pob pop_back
#define MOD 1000000007
#define sz(x) (int)x.size()
#define FOR(i, j, k) for(i = j;i < k;i++)
void odd_even(int num)
{
    if(num & 1) cout << "odd";//last bit is 1
    if(~num & 1) cout << "even";//last bit is 0
}
void solve(int ind){
   int n1, n2, k1, k2;
   cin >> n1 >> n2 >> k1 >> k2;
   bool turn = 0;
   bool p = 1;
   while(p) {
        if(!turn) {
            if(n1==0) {
                p = 0; 
            }
            else {n1-=1;turn=1;}
        }
        else {
            if(n2==0) {
                p = 0;
            }
            else {n2-=1;turn=0;}
        }
   }
   if(!turn) cout << "Second";
   else cout << "First";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt=1, k = 1;
    //cin >> tt;
    while(tt--) {
        solve(k);
        k++;
        cout << "\n";
    }

    /*while(scanf("%d %d", &a, &b)!=EOF){
            //fill it in
    }*/
    //solve(0);
    //exception_handle();

}


  		       	   				 	 	 	 		 	


Comments

Submit
0 Comments
More Questions

1657C - Bracket Sequence Deletion
1657B - XY Sequence
1009A - Game Shopping
1657A - Integer Moves
230B - T-primes
630A - Again Twenty Five
1234D - Distinct Characters Queries
1183A - Nearest Interesting Number
1009E - Intercity Travelling
1637B - MEX and Array
224A - Parallelepiped
964A - Splits
1615A - Closing The Gap
4C - Registration System
1321A - Contest for Robots
1451A - Subtract or Divide
1B - Spreadsheet
1177A - Digits Sequence (Easy Edition)
1579A - Casimir's String Solitaire
287B - Pipeline
510A - Fox And Snake
1520B - Ordinary Numbers
1624A - Plus One on the Subset
350A - TL
1487A - Arena
1520D - Same Differences
376A - Lever
1305A - Kuroni and the Gifts
1609A - Divide and Multiply
149B - Martian Clock