当前位置:网站首页>1035 password (20 points)
1035 password (20 points)
2022-06-30 14:55:00 【Xue Dongjing】
1035 Password (20 branch )
The question
Give a set of member information , Include member name and password , If there is... In the password ‘1’ Change to ‘@’, Yes ‘0’ Change to ‘%’, Yes ‘l’( A lowercase letter L) Change to ’L‘, Yes ’O‘ Change to ’o’.
Output the number of people to change the password , And the modified information of these people ( name Modified password )
If no one's password needs to be changed , The output “There are N accounts and no account is modified”,N Is the total number of restructured members , If N by 1, The output of “There is 1 account and no account is modified”
Ideas
Create a member information structure , Include name and password , And a modification bit . Check whether the password needs to be modified and modify , And set the modification of the member to 1, It is convenient for judgment when outputting the information of modifying members later .
Finally, judge the total number of people and the number of people to be modified , Output the information of the member to be modified .
Be careful N by 1 Different output at .
Code
#include<stdio.h>
#include<string.h>
typedef struct node{
char name[20],password[20];
bool modify=0;
}node;
node member[2007];
void print(int n,int count)
{
if(count==0){
if(n==1){
printf("There is 1 account and no account is modified\n");
}else{
printf("There are %d accounts and no account is modified\n",n);
}
}else{
printf("%d\n",count);
for(int i=0;i<n;i++){
if(member[i].modify==1){
printf("%s %s\n",member[i].name,member[i].password);
}
}
}
}
int main()
{
int n,count=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
getchar();
scanf("%s %s",member[i].name,member[i].password);
for(int j=0;j<strlen(member[i].password);j++){
if(member[i].password[j]=='1'){
member[i].modify=1;
member[i].password[j]='@';
}
if(member[i].password[j]=='0'){
member[i].modify=1;
member[i].password[j]='%';
}
if(member[i].password[j]=='l'){
member[i].modify=1;
member[i].password[j]='L';
}
if(member[i].password[j]=='O'){
member[i].modify=1;
member[i].password[j]='o';
}
}
if(member[i].modify==1){
count++;
}
}
print(n,count);
return 0;
}
边栏推荐
- CCF Z-scan (full mark code + problem solving ideas) 201412-2
- How to get palindrome number in MATLAB (using fliplr function)
- day02
- 1107 social clusters (30 points)
- PS dynamic drawing
- Vue returns to the previous page without refreshing the page / Vue caches the page
- Add attributes to multimode
- 机械工程师面试的几个问题,你能答上来几个?
- jsPlumb. Deleteeveryconnection is not a function & jsplumb clear canvas jsplumb delete all nodes and all connections
- catkin_ Make reports an error, transfers the location of the workspace, and uses other people's workspace files to cause compilation errors
猜你喜欢
2021-05-12
[buuctf] [actf2020 freshman competition]exec1
CCF window (Full Score code + problem solving idea) March 2, 2014
After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
Determine the number of digits of an integer in MATLAB (one line of code)
val_ Loss decreases first and then increases or does not decrease but only increases
Learn about data kinship JSON format design from sqlflow JSON format
[buuctf] [geek challenge 2019] secret file
Knowledge learned from the water resources institute project
ES6 notes
随机推荐
HD mechanical principle · classic dynamic drawing of mechanical design
Not satisfied with markdown native code block style? Try this beautify code screenshot tool~~
Steps for commissioning of vertical machining center
V3 03_ Getting started
Matlab construction operation example
PS dynamic drawing
After the MySQL service on the local computer is started and stopped, some services will automatically stop when they are not used by other services or programs
2021-08-07 native and package types
Matlab calculates the factorial sum of the first n numbers (easy to understand)
Analysis on the problems of irregular step hole on horizontal machining center
1130: find the first character that appears only once
Is it troublesome for CITIC futures to open an account? Is it safe? How much is the handling charge for opening an account for futures? Can you offer a discount
CCF sequence segmentation (Full Score code + problem solving idea) 201509 -1
1137: encrypted medical record
Quick sort (C language)
Programming of left-hand trapezoidal thread
文本匹配——【NAACL 2021】AugSBERT
Matlab two-dimensional array example (extract data)
ES6 notes
高精度CNC加工中心为什么会出现误差?这4个原因你要注意!