当前位置:网站首页>C-11 problem I: find balloon
C-11 problem I: find balloon
2022-04-23 03:21:00 【Tang Encheng_ hhhc】
Problem I: Find balloon
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 1854 Solved: 986
Description
zstu Training teams often hold monthly competitions , But balloons are often not enough . There are multiple barrels , Each barrel has a color , Each bucket may correspond to multiple questions , Give the bucket corresponding to each question , When playing games , Often a problem is found to be a water problem , But the balloon of that color is gone , therefore quxing201606 You can only use balloons of another color instead of , That is to change the color of a barrel to another color .quxing201606 I also want to know what color a question is ( The color of the barrel that belongs to ).( Must be done with an array of pointers !!!)
Input
Multiple tests , Two Numbers n,m,(n<=100) Express n Questions ,(m<=100) Express m A barrel . Next m Number , The first i The number represents the number i The color of each bucket . then n Number , It means the first one i Which bucket does the question belong to . Next one q(<=100), Express q Operations , then q That's ok , First in each line op, Indicates what operation .op by 1 when , Two Numbers x,y, Express the x The color of each bucket changes to y.op by 2 when , a number x, Indicates the number of queries x The balloon color of the question
Output
For each op by 2 An output operand of , What color is the balloon corresponding to this question
Sample Input
3 2
3 4
1 1 2
3
2 1
1 1 2
2 2
Sample Output
3
2
#include <stdio.h>
int main()
{
int n,m;
while (scanf("%d%d",&n,&m) != EOF)
{
int i,j;
int *to[102];
int *ti[102];// The initialization of pointer array is realized through another array
int a[102],b[102];// So define two arrays , They correspond to each other ti,to
// Initialize pointer array
for (i = 1;i <= m;i++)
{
scanf("%d",&b[i]);
to[i] = &b[i];
}
for (i = 1;i <= n;i++)
{
scanf("%d",&a[i]);
ti[i] = &a[i];
}
int T,flag;
scanf("%d",&T);
for (i = 0;i < T;i++)
{
scanf("%d",&flag);
if (flag == 1)
{
int item ;
scanf("%d",&item);
scanf("%d",&b[item]);
to[item] = &b[item];
// printf("to = %d\n",*(to[item]));
}
else
{
int S;
scanf("%d",&S);
int tong = *(ti[S]);
printf("%d\n",*(to[tong]));
}
}
}
return 0;
}
I've been doing reading comprehension , There are many inputs to this question , So be sure to check scanf Is the quantity correct , I can't find mistakes like a fool , It turned out to be right T I forgot my assignment .
Do this question. , There's no other way , Understanding the meaning of the question accurately as soon as possible is the most important , Two words : careful , Patience, .
版权声明
本文为[Tang Encheng_ hhhc]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220621320119.html
边栏推荐
- JS implementation of new
- Student achievement management
- Explanation keyword of MySQL
- 你真的懂hashCode和equals吗???
- 批量下載文件----壓縮後再下載
- Knowledge of software testing~
- 软件测试相关知识~
- Scenario Title: how does system a use the page of system B
- socket編程 send()與 recv()函數詳解
- General testing technology [1] classification of testing
猜你喜欢

Build websocket server in. Net5 webapi

搭建XAMPP时mysql端口被占用

After the mobile phone is connected to the computer, how can QT's QDIR read the mobile phone file path

一文了解全面静态代码分析

关于idea调试模式下启动特别慢的优化

2022a special equipment related management (elevator) work license question bank and simulation examination

The most easy to understand service container and scope of dependency injection

Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions

Course design of Database Principle -- material distribution management system

Utgard connection opcserver reported an error caused by: org jinterop. dcom. common. JIRuntimeException: Access is denied. [0x800
随机推荐
Téléchargement en vrac de fichiers - téléchargement après compression
Yes Redis using distributed cache in NE6 webapi
Comprehensive calculation of employee information
The most understandable life cycle of dependency injection
Seminar playback video: how to improve Jenkins' ability to become a real Devops platform
C language to achieve address book - (static version)
POI create and export Excel based on data
Five tips for cross-border e-commerce in 2022
Optimization of especially slow startup in idea debugging mode
General test technology [II] test method
Course design of Database Principle -- material distribution management system
oracle 查询外键含有逗号分隔的数据
C introduction of variable parameter params
Explanation keyword of MySQL
搭建XAMPP时mysql端口被占用
Explication détaillée des fonctions send () et recv () du programme Socket
Advanced sorting - fast sorting
《C语言程序设计》(谭浩强第五版) 第9章 用户自己建立数据类型 习题解析与答案
Flink实时数仓项目—DWS层设计与实现
PID debugging of coding motor (speed loop | position loop | follow)