当前位置:网站首页>[pat (basic level) practice] - [simple simulation] 1076 WiFi password
[pat (basic level) practice] - [simple simulation] 1076 WiFi password
2022-06-11 23:53:00 【IronmanJay】
List of articles
One 【 questions 】
- Class B
Two 【 Title number 】
- 1076 Wifi password (15 branch )
3、 ... and 【 Title Description 】
- Here's a picture circulating on Weibo :“ Dear students , Since you sometimes need to use wifi, I'm afraid to delay my parents' study , Will now wifi The password is set to answer the following math question :A-1;B-2;C-3;D-4; Please answer by yourself , Change every two days . Thank You for Your Cooperation !!~”—— In order to promote students' learning, teachers also work hard …… This question requires you to write a program to translate the answers to a series of questions into wifi Password . Let's simply assume that each multiple-choice question has 4 An option , Yes and only 1 Right answer .

Four 【 Title Example 】
Input format :
The first line of input gives a positive integer N(≤ 100), And then N That's ok , Each line follows Number - answer The format gives the of a problem 4 An option ,T Indicates the correct option ,F Indicates the wrong option . The options are separated by spaces .Output format :
Output in one line wifi password .sample input :
8
A-T B-F C-F D-F
C-T B-F A-F D-F
A-F D-F C-F B-T
B-T A-F C-F D-F
B-F D-T A-F C-F
A-T C-F B-F D-F
D-T B-F C-F A-F
C-T A-F B-F D-Fsample output :
13224143
5、 ... and 【 Their thinking 】
- This topic is relatively simple , Just scan the input , Output according to the corresponding results . It's just a pit , We need to use g e t c h a r ( ) getchar() getchar() Functions absorb extra spaces and line breaks , Otherwise, the result will be wrong
6、 ... and 【 The final score 】
- 15 branch
7、 ... and 【 Code implementation 】
#include<stdio.h>
int main()
{
int n;
scanf("%d",&n);
getchar();
for(int i = 0;i<n;i++)
{
for(int j = 0;j<4;j++)
{
char no,answer;
scanf("%c-%c",&no,&answer);
getchar();
if(answer == 'T')
{
if(no == 'A')
{
printf("1");
}
else if(no == 'B')
{
printf("2");
}
else if(no == 'C')
{
printf("3");
}
else if(no == 'D')
{
printf("4");
}
}
}
}
return 0;
}
8、 ... and 【 Submit results 】

边栏推荐
- require. context
- chisel环境搭建(win10 + vscode)
- What is webstorage? And cookies
- mysql5和mysql8同时安装
- 【JUC系列】Executor框架之概览
- 【BBC learningenglish】with Tango
- Lake Shore VNF 系列低温恒温器系统——流动蒸汽中的样品
- (counting class +dp) acwing 900 Integer partition
- Vs code writing assembly code [microcomputer principle]
- C language leetcode deleting duplicate items in an ordered array
猜你喜欢

Remix localization, loading local contract file, local link Remix

2022 high voltage electrician test question simulation test question bank and online simulation test

sonarqube介紹和安裝步驟

(dp) acwing 902. Minimum editing distance

A new product with advanced product power, the new third generation Roewe rx5 blind subscription is opened

删除收货地址【项目 商城】

2022 safety officer-a certificate test question simulation test platform operation

Live broadcast preview | featurestore meetup V3 is coming!
![[C language] data type storage, original code, inverse code and complement code](/img/ce/36363647d745c018d911588476e441.jpg)
[C language] data type storage, original code, inverse code and complement code

Cisco private dynamic routing protocol: EIGRP
随机推荐
chisel环境搭建(win10 + vscode)
PHP mkdir(): Permission denied上传文件会把文件夹权限改为411权限
免费分享1个新媒体运营必备的宝藏网站
Two way leading circular linked list (C language)
(dp+ longest common subsequence) acwing 897 Longest common subsequence
(counting class +dp) acwing 900 Integer partition
C language Niuke net string space substitution
删除收货地址【项目 商城】
[signals and systems] (XXI) Laplace transform and complex frequency domain analysis -- Laplace transform and its properties
Setting alias alias and @ reference note
Top selling commodities 【 project mall 】
Lake Shore VNF 系列低温恒温器系统——流动蒸汽中的样品
Les produits antigéniques entrent dans la famille et les entreprises chinoises de dispositifs médicaux accueillent un nouvel océan bleu
11. conditional statement if, switch
Lake Shore—SuperTran-VP 连续流低温恒温器系统
C language leetcode deleting duplicate items in an ordered array
Live broadcast preview | featurestore meetup V3 is coming!
What is bom? And knowledge points
SF14 | supertrend "super trend" indicator magic change and upgrade (source code)
In order to stimulate inspiration and creativity, Shanghai daoning united with XMIND to bring you full-featured mind mapping and brainstorming software