50161. Memory Game

難度:2/5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))

int n;
int memory[105];

int main(){
scanf("%d", &n);
for(int i = 1; i <= 100; i++) memory[i] = -1;

for(int i = 0; i < n; i++){
int now_num; scanf("%d", &now_num);
if(memory[now_num] == -1){
printf("%d\n", i);
memory[now_num] = i;
}
else{
printf("%d %d %d\n", i, memory[now_num], now_num);
memory[now_num] = -1;
}
}
}


50161. Memory Game
https://aaronlin1229.github.io/judgegirl_50161/
Author
Akizumi
Posted on
July 17, 2023
Licensed under