日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

Codeforces 841 B Godsend

發布時間:2024/3/24 53 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Codeforces 841 B Godsend 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題目地址
題意:給你n個數,有兩個人去取數(可以取多個),第一個人的取數規則是取出的數的和為奇數,第二個人的取數規則是取出的數的和為偶數,如果有人去不了了就是另一個人贏了。
思路:有兩種條件,一種全部數的和為奇數,那明顯是第一個人贏了,直接全部取走就好了。第二種就是全部數的和為偶數,那第一個人先取奇數(如果有),剩下的和是奇數,第二個人也取不了,所以當n個數中有奇數的話,肯定是第一個人贏了。

#include <iostream> #include <cstring> #include <string> #include <queue> #include <vector> #include <map> #include <set> #include <stack> #include <cmath> #include <cstdio> #include <algorithm> #define N 3010 #define LL __int64 #define inf 0x3f3f3f3f #define lson l,mid,ans<<1 #define rson mid+1,r,ans<<1|1 #define getMid (l+r)>>1 #define movel ans<<1 #define mover ans<<1|1 using namespace std; const LL mod = 1e9 + 7; map<char, int> mapp; int main() {cin.sync_with_stdio(false);int n, m;while (cin >> n) {for (int i = 0; i < n; i++) {cin >> m;if (m % 2) {cout << "First" << endl;return 0;}}cout << "Second" << endl;}return 0; }

總結

以上是生活随笔為你收集整理的Codeforces 841 B Godsend的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。