掉石頭問題
user_3763047219
c_cpp
3 years ago
624 B
7
Indexable
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include<math.h>
#include<stdlib.h>
int main()
{
int num = 0;
int stone[10000][2] = {0};
int index = 0;
char end;
do {
scanf("%d", &num);
int count = 0;
for (int i = 0; i <= index; i++) {
if (num == stone[i][0]) {
stone[i][1] = stone[i][1] + 1;
count = -1;
break;
}
}
if (count != -1) {
index++;
stone[index][0] = num;
stone[index][1] = 1;
}
} while (end = getchar() != '\n');
for (int i = 1; i <= index; i++) {
if (stone[i][1] % 3!=0) {
printf("%d", stone[i][0]);
break;
}
}
}Editor is loading...