当前位置:网站首页>Contest3145 - the 37th game of 2021 freshman individual training match_ G: Score
Contest3145 - the 37th game of 2021 freshman individual training match_ G: Score
2022-07-04 02:34:00 【This question AC sleep again】
//
problem G: The score
The time limit : 1.000 Sec Memory limit : 128 MB
Title Description
Xiaohua likes a player named fan Zhendong most in the table tennis hall , Today, he lay on the window and watched their training all afternoon , Until he was driven away by the cleaning uncle . Xiaohua has a very good memory , Can record the whole afternoon of the game , For example, it records ( among F It means that fan Zhendong won a point ,A It means that fan Zhendong's opponent gets a point ):FFFFFFFFFFFFFFFFFFFFFFAF. Under the current competition system , At this time, the result of the game is fan Zhendong's first game 11 Than 0 win victory , The second inning 11 Than 0 win victory , The third game is in progress , The current score 1 Than 1.
Because Xiaohua is too absorbed , Didn't pay attention to the score at all , So that it doesn't know the specific score of the afternoon , So Xiaohua asked her good friend programming rabbit to help . But the programming rabbit went to dig carrots , So Xiaohua came to the clever children for help .
Your program is to input a series of game information (FA form ), Output the right results .
notes :
1) Currently using 11 " , To 10 Ping Hou , Need to win 2 Points after , To win , Such as :12:10;17:15 etc. .
2) If a game starts , Then the score does not have to be output .
3) Input data can be at most 20 Letters , The number of lines may be many , There may be at most 10000 That's ok .
Input
The input contains several lines of string ( At most... Per line 20 Letters ), The string is capitalized F、A and E form . among E Indicates the end of the game information , The program should ignore E Everything after that .
Output
The output has several lines , Each line corresponds to the score of a game ( In order of input ).
The sample input Copy
FFFFFFFFFFFFFFFFFFFF
FFAFE
Sample output Copy
11:0
11:0
1:1
Tips
front 11 All points are F, So the first set 11:0, after 11 All points F, So the second sentence is also 11:0, The last two points are A and F, So it is 1:1,E End of the said .
Each line has at most 20 Characters , Only F、A and E Three letters .
about 30% The data of , There is only one line of input .
about 60% The data of , Input no more than 10 That's ok .
about 100% The data of , Input data no more than 10000 That's ok .//
#include<bits/stdc++.h>
using namespace std;
// Input data can be at most 20 Letters
const int MAXN=22;
char str[MAXN];
int main()
{
int i,a,b,flag;
a=b=flag=0;
while( ~scanf("%s",str) )
{
for( i=0;str[i];i++ )
{
if( str[i]=='E' ) { flag=1; break; } // and break together Cannot use comma expression
else if( str[i]=='F' ) a++;
else if( str[i]=='A' ) b++;
if( a>=10 && b>=10 ) // Currently using 11 " , To 10 Ping Hou , Need to win 2 Points after , To win
{
if( abs(a-b)>=2 ) { printf("%d:%d\n",a,b); a=b=0; }
}
else if( a==11 && b<10 ) { printf("%d:%d\n",a,b); a=b=0; }
else if( b==11 && a<10 ) { printf("%d:%d\n",a,b); a=b=0; }
}
if( flag )
{ // || One possibility is 0
if( a || b ) printf("%d:%d\n",a,b); // If a game starts , Then the score does not have to be output
break;
}
}
return 0;
}//
find:
01 List possible situations ( Construct special data ) First judge the special data
a>=10 && b>=10
01 |a-b|>=2 printf
02 ... continue
a==11 && b<10
b==11 && a<10边栏推荐
- PTA tiantisai l1-079 tiantisai's kindness (20 points) detailed explanation
- Database concept and installation
- Talking about custom conditions and handling errors in MySQL Foundation
- Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
- Johnson–Lindenstrauss Lemma
- Network byte order
- AI 助力藝術設計抄襲檢索新突破!劉芳教授團隊論文被多媒體頂級會議ACM MM錄用
- Yyds dry goods inventory hand-in-hand teach you the development of Tiktok series video batch Downloader
- The "message withdrawal" of a push message push, one click traceless message withdrawal makes the operation no longer difficult
- Intel's new GPU patent shows that its graphics card products will use MCM Packaging Technology
猜你喜欢

false sharing

96% of the collected traffic is prevented by bubble mart of cloud hosting

1189. Maximum number of "balloons"

7 * 24-hour business without interruption! Practice of applying multiple live landing in rookie villages

Small program graduation project based on wechat examination small program graduation project opening report function reference

Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference

Valentine's Day - 9 jigsaw puzzles with deep love in wechat circle of friends

ZABBIX API pulls the values of all hosts of a monitoring item and saves them in Excel

A brief talk on professional modeler: the prospect and professional development of 3D game modeling industry in China
![Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine](/img/3a/cf6285ae1c01bda42874eeca9fe5b1.jpg)
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine
随机推荐
Yyds dry goods inventory override and virtual of classes in C
[untitled] the relationship between the metauniverse and digital collections
3D game modeling is in full swing. Are you still confused about the future?
Override and virtual of classes in C #
Create template profile
Libcblas appears when installing opencv import CV2 so. 3:cannot open shared object file:NO such file or directory
96% of the collected traffic is prevented by bubble mart of cloud hosting
C # learning notes: structure of CS documents
查詢效率提昇10倍!3種優化方案,幫你解决MySQL深分頁問題
When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview
The difference between int (1) and int (10)
Sword finger offer 14- I. cut rope
Node write API
[Yugong series] February 2022 attack and defense world advanced question misc-83 (QR easy)
Lichuang EDA learning notes 14: PCB board canvas settings
VRRP+BFD
Small program graduation design is based on wechat order takeout small program graduation design opening report function reference
Unspeakable Prometheus monitoring practice
What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
Redis transaction