当前位置:网站首页>Rock-paper-scissors
Rock-paper-scissors
2022-07-07 23:39:00 【Yuesi】
Topic :
Stone scissors paper is a common guessing game . Stone is better than scissors , Scissors are better than cloth , Busson stone . If two people punch the same way , It's a draw .
One day , Small AA And small BB Just playing with stone scissors and paper . It's known that their fists are periodic , such as :“ stone - cloth - stone - scissors - stone - cloth - stone - scissors ……”, That is to say “ stone - cloth - stone - scissors ” For the cycle of . Excuse me, , Small AA And small BB Than the NN After the round , Who wins more rounds ?
Input format
The input contains three lines .
The first line contains three integers :N,NA,NB, They are better than N round , Small AA The cycle length of the punch , Small BB The cycle length of the punch .0 < N,NA,NB < 1000<N,NA,NB<100.
The second line contains NA It's an integer , It means small A The law of punching .
The third line contains NB It's an integer , It means small B The law of punching .
among ,0 Express “ stone ”,2 Express “ scissors ”,5 Express “ cloth ”. Two adjacent integers are separated by a single space .
Output format
Output one line , If small A More rounds won , Output "A"; If small B More rounds won , Output "B"; If the two are even , Output “draw”.
Tips
For test data , The guessing process is :
A:0 2 5 0 2 5 0 2 5 0
B:0 5 0 2 0 5 0 2 0 5
AA Win. 44 round ,BB Win. 22 round , The two sides are even 44 round , therefore AA More rounds won .
Extra space at the end of each line when outputting , It doesn't affect the correctness of the answer
The sample input
10 3 4
0 2 5
0 5 0 2
Sample output
A
#include<bits/stdc++.h>
using namespace std;
int main(){
int a[400],b[400];
int n,a1,a2;
int k1=0,k2=0,ping=0;
scanf("%d%d%d",&n,&a1,&a2);
for(int i=1;i<=a1;i++){
scanf("%d",&a[i]);
}
for(int i=1;i<=a2;i++){
scanf("%d",&b[i]);
}
if(a1<n){
for(int i=a1+1;i<=n;i++){
if(i%a1==0){
a[i]=a[a1];
}else{
a[i]=a[i%a1];
}
}
}
if(a2<n){
for(int i=a2+1;i<=n;i++){
if(i%a2==0){
b[i]=b[a2];
}else{
b[i]=b[i%a2];
}
}
}
for(int i=1;i<=n;i++){
if(a[i]!=b[i]){
if(a[i]==0){
if(b[i]==2){
k1++;
}
if(b[i]==5){
k2++;
}
}
if(a[i]==2){
if(b[i]==5){
k1++;
}
if(b[i]==0){
k2++;
}
}
if(a[i]==5){
if(b[i]==0){
k1++;
}
if(b[i]==2){
k2++;
}
}
}
if(a[i]==b[i]){
ping++;
}
}
if(k1==k2){
printf("draw\n");
}
if(k1>k2){
printf("A\n");
}
if(k1<k2){
printf("B\n");
}
return 0;
}
边栏推荐
- C number of words, plus ¥, longest word, average value
- B_QuRT_User_Guide(40)
- 2022 certified surveyors are still at a loss when preparing for the exam? Teach you how to take the exam hand in hand?
- What if once again forgets the login password of raspberry pie? And you don't have a monitor yet! Today, I would like to introduce a method
- MongoDB快速入门
- MySQL Architecture
- FPGA basics catalog
- Sequence of entity layer, Dao layer, service layer and controller layer
- Deep understanding of MySQL lock and transaction isolation level
- JNI uses asan to check memory leaks
猜你喜欢
![[compilation principle] lexical analysis design and Implementation](/img/8c/a3a50e6b029c49caf0d791f7d4513a.png)
[compilation principle] lexical analysis design and Implementation

SAP HR 劳动合同信息 0016

New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held

ESP at installation esp8266 and esp32 versions

Svn relocation

包装行业智能供应链S2B2B商城解决方案:开辟电商消费新生态

MySQL Architecture

【实验分享】通过Console口登录到Cisco设备

Markdown

家用电器行业渠道商协同系统解决方案:助力家电企业快速实现渠道互联网化
随机推荐
Digital procurement management system for fresh food industry: help fresh food enterprises solve procurement problems and implement online procurement throughout the process
Stringutils tool class
Take you hand in hand to build feign with idea
ASP. Net open web page
进度播报|广州地铁七号线全线29台盾构机全部完成始发
2022 Season 6 perfect children's model Shaanxi finals came to a successful conclusion
How to change the formula picture in the paper directly into the formula in word
postgres timestamp转人眼时间字符串或者毫秒值
Pycharm essential plug-in, change the background (self use, continuous update) | CSDN creation punch in
建筑建材行业SRM供应商云协同管理平台解决方案,实现业务应用可扩展可配置
IDEA 2021.3. X cracking
电子设备行业智能供应链协同平台解决方案:解决低效, 赋能产业数字化升级
Get started with mongodb
Anxinco esp32-a1s development board is adapted to Baidu dueros routine to realize online voice function
New potential energy of industrial integration, Xiamen station of city chain technology digital summit successfully held
Windows set redis to start automatically
USB (XIV) 2022-04-12
Ora-01741 and ora-01704
UE4_ Use of ue5 blueprint command node (turn on / off screen response log publish full screen display)
B_QuRT_User_Guide(37)