[Codeforces] 1013A. Piles With Stones

題目URL: http://codeforces.com/contest/1013/problem/A
這題......我只恨題目囉嗦......嘛......訓練讀英題,好啦,總之把這一歸納一下,即可得知只是把兩陣列的總和拿去做比較。

#include<bits/stdc++.h>
using namespace std;
int stra,strb;
main()
{
    int num,totala=0,totalb=0;
    cin >> num;
    for(int i=0;i<num;i++)
    {
        cin >> stra;
        totala+=stra;
    }
    for(int i=0;i<num;i++)
    {
        cin >> strb;
        totalb+=strb;
    }
    if(totala>=totalb)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

留言

這個網誌中的熱門文章

[ZJ] b229: TOI 2009 第一題:路徑問題

交大資工(APCS組)(面試&心得)

滿是挫傷的ION CAMP