Zerojudge e286
題敘
https://zerojudge.tw/ShowProblem?problemid=e286
給兩場比賽中四局的兩隊比數,求輸贏與比分
想法
跟著題目照做即可
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #include<bits/stdc++.h> #define LL long long #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); #define pii pair<int,int> using namespace std; int tmp,A_win=0,B_win=0,tot_a=0,tot_b=0;; int main(){ IOS for(int k=0 ; k<2 ; k++){ tot_a = tot_b = 0; for(int i=0 ; i<4 ; i++){ cin>>tmp; tot_a+=tmp; } for(int j=0 ; j<4 ; j++){ cin>>tmp; tot_b+=tmp; } cout<<tot_a<<":"<<tot_b<<"\n"; if(tot_a>tot_b) A_win++; else if(tot_a<tot_b) B_win++; } if(A_win>B_win) cout<<"Win\n"; else if(B_win>A_win) cout<<"Lose\n"; else cout<<"Tie\n"; return 0; }
|
複雜度
$O(1)$