Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- #include <ctype.h>
- #include <string.h>
- #pragma warning(disable:4996)
- typedef long long LL, s64;
- typedef unsigned long long ULL, u64;
- #define MIN(x,y) (((x)>(y))?(y):(x))
- #define MAX(x,y) (((x)>(y))?(x):(y))
- typedef struct _data{
- char name[64], sex[8];
- int sid;
- LL contact;
- }data;
- data a[128] = { 0 };
- int main(){
- #ifdef _DEBUG
- FILE *fp = freopen("../../../input.txt", "r", stdin);
- //FILE *fp2 = freopen("output.txt", "w", stdout);
- #endif // _DEBUG
- int i, n, m, op, inid; LL incontact;
- scanf("%d%d", &n, &m);
- for(i = 0; i < n; i++){
- scanf("%s%d%s%lld", a[i].name, &(a[i].sid), a[i].sex, &(a[i].contact));
- }
- while(m--){
- scanf("%d", &op);
- if(op == 1){
- scanf("%s%d%s%lld", a[n].name, &(a[n].sid), a[n].sex, &(a[n].contact));
- n += 1;
- }
- else if(op == 2){
- scanf("%d%lld", &inid, &incontact);
- for(i = 0; i < n; i++){
- if(a[i].sid == inid){
- a[i].contact = incontact;
- }
- }
- }
- }
- for(i = 0; i < n; i++){
- printf("%s %d %s %lld\n", a[i].name, a[i].sid, a[i].sex, a[i].contact);
- }
- #ifdef _DEBUG
- fp = freopen("CON", "r", stdin);
- system("pause");
- #endif // _DEBUG
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment