当前位置:网站首页>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
边栏推荐
- Mysql database design specification
- 研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台
- Mysql database
- [mock data] fastmock dynamically returns the mock content according to the incoming parameters
- Comprehensive calculation of employee information
- Blazor University (12) - component lifecycle
- js递归树结构计算每个节点的叶子节点的数量并且输出
- Chapter 9 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of exercises for users to establish their own data types
- MySQL索引详解【B+Tree索引、哈希索引、全文索引、覆盖索引】
- MySql关键字GROUP_CONCAT,组合连接查询
猜你喜欢

When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director

Drawing polygons with < polygon / > circular array in SVG tag

C WPF UI framework mahapps switching theme

The most understandable life cycle of dependency injection
![[Mysql] LEFT函數 | RIGHT函數](/img/26/82e0f2280de011636c26931a74e749.png)
[Mysql] LEFT函數 | RIGHT函數

OLED multi-level menu record

A set of combination boxing to create an idea eye protection scheme

为什么BI对企业这么重要?

Supersocket is Use in net5 - startup

Experiment 5 components and event handling
随机推荐
数据挖掘系列(3)_Excel的数据挖掘插件_估计分析
New ORM framework -- Introduction to beetlsql
Huawei mobile ADB devices connection device is empty
A comprehensive understanding of static code analysis
Peut recevoir plusieurs paramètres de type de données - paramètres variables
socket编程 send()与 recv()函数详解
2022 Shandong Province safety officer C certificate work certificate question bank and online simulation examination
Idea view history [file history and project history]
Chapter 7 of C language programming (fifth edition of Tan Haoqiang) analysis and answer of modular programming exercises with functions
Mise en service PID du moteur de codage (anneau de vitesse | anneau de position | suivant)
Knowledge of software testing~
Is it difficult to choose binary version control tools? After reading this article, you will find the answer
Supersocket is Use in net5 - concept
. NETCORE sets the API post mode, which can accept parameters directly in parentheses
Experiment 6 input / output stream
二进制文件版本控制工具选择难?看完这篇你会找到答案
Super easy to use asynchronous export function of Excel
数据库表中不建索引,在插入数据时,通过sql语句防止重复添加(转载)
When migrating tslib_ setup: No such file or directory、ts_ open: No such file or director
研讨会回放视频:如何提升Jenkins能力,使其成为真正的DevOps平台