日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【思维】Iranian ChamPions Cup

發(fā)布時(shí)間:2025/3/8 编程问答 16 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【思维】Iranian ChamPions Cup 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

題目描述

The Iranian ChamPions Cup (ICPC), the most prestigious football league in Iran, is reaching its end, and people are eagerly waiting for the finals, which happened to be between the two most popular Iranian teams, Persepolis and Esteghlal.
The ICPC finals consist of two matches, with each team competing as the home team in one match. The winning team is determined by aggregate score, the sum of the scores of the two matches. For example, if the scores of the two matches
are Persepolis 6–0 Esteghlal in the first match, and Esteghlal 3–1 Persepolis in the second match, then the aggregate score will be Persepolis 7–3 Esteghlal, meaning that Persepolis is the winner. If aggregates are equal, the away goals rule is used to determine the winner, in which case the winner is the team that scored the most goals in the match it played away from home. If the result is still equal, a penalty shootout is required.
Hana, an avid football fan, is trying to figure out various scenarios in which her favorite team wins the finals. To this end, she aims to write a program that gets as input the number of goals in the two matches, and decides which team is the winner if it can be derived from the aggregate scores and the away goals rule, otherwise declares that the match goes to penalty kicks. You are going to help Hana write such a program.

?

輸入

The first line of the input contains two space-separated integers p1 and s1 , where p1 and s1 are the number of goals scored by Persepolis and Esteghlal, respectively, in the first match in which Persepolis is the home team. The second line contains two space-separated integers s2 and p2 , where s2 and p2 are the number of goals scored by Esteghlal and Persepolis, respectively, in the second match in which Esteghlal is the home team. All input integers are between 0 and 20, inclusively.

?

輸出

In the output, print the name of the winning team, either Persepolis or Esteghlal, if the winner can be determined by the aggregate scores and the away goals rule. Otherwise, print Penalty.

?

樣例輸入

復(fù)制樣例數(shù)據(jù)

3 0 2 1

樣例輸出

Persepolis

?

題目大意:

第一行輸入兩個(gè)整數(shù),代表以?Persepolis?為主場(chǎng)時(shí)?Persepolis 與?Esteghlal的比分,假如為6:0,而第二行則是以Esteghlal為主場(chǎng)Esteghlal與?Persepolis的比分,假如為2:1,則可以看出最終比分?Persepolis:Esteghlal為7:2,此時(shí)?Persepolis 獲勝,若兩隊(duì)的比分相同,則按照客場(chǎng)規(guī)則,客場(chǎng)進(jìn)球多的隊(duì)伍獲勝,若仍相同,則需進(jìn)行點(diǎn)球大賽,輸出Penalty。

解題思路:

看懂題意后其實(shí)十分簡(jiǎn)單,進(jìn)行簡(jiǎn)單的比較判斷即可。

代碼:

#include <cstdio> #include <iostream> #include <algorithm> #include <cmath> #include <cstdlib> #include <cstring> #include <map> #include <stack> #include <queue> #include <vector> #include <bitset> #include <set> #include <utility> #include <sstream> #include <iomanip> using namespace std; typedef long long ll; typedef unsigned long long ull; #define inf 0x3f3f3f3f #define rep(i,l,r) for(int i=l;i<=r;i++) #define lep(i,l,r) for(int i=l;i>=r;i--) #define ms(arr) memset(arr,0,sizeof(arr)) //priority_queue<int,vector<int> ,greater<int> >q; const int maxn = (int)1e5 + 5; const ll mod = 1e9+7; int main() {#ifndef ONLINE_JUDGEfreopen("in.txt", "r", stdin);#endif//freopen("out.txt", "w", stdout);ios::sync_with_stdio(0),cin.tie(0);int a1,b1,a2,b2;cin>>a1>>b1>>a2>>b2;int t1=a1+b2;int t2=a2+b1;if(t1>t2) cout<<"Persepolis"<<endl;else if(t1<t2) cout<<"Esteghlal"<<endl;else {if(b1<b2) cout<<"Persepolis"<<endl;else if(b1>b2) cout<<"Esteghlal"<<endl;else cout<<"Penalty"<<endl;}return 0; }

?

總結(jié)

以上是生活随笔為你收集整理的【思维】Iranian ChamPions Cup的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。