-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUVA11344.cpp
More file actions
43 lines (43 loc) · 854 Bytes
/
UVA11344.cpp
File metadata and controls
43 lines (43 loc) · 854 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
int n, inn[99999];
char in[99999] = { 0 }, in2[99999] = { 0 }, *ptr;
while (scanf("%d", &n) != EOF) {
getchar();
while (n--) {
gets_s(in);
gets_s(in2);
int f = 0;
ptr = strtok(in2, " ");
while (ptr != NULL) {
sscanf(ptr, "%d", &inn[f]);
f++;
ptr = strtok(NULL, " ");
}
int temp, buffer;
for (int j = 1; j < f; j++) {
temp = 0;
for (int i = 0; i < strlen(in); i++) {
buffer = in[i] - '0';
temp = temp * 10 + buffer;
temp %= inn[j];
}
if (temp)
break;
}
if (temp)
printf("%s - Simple.\n", in);
else
printf("%s - Wonderful.\n", in);
for (int i = 0; in[i]; i++)
in[i] = '\0';
for (int i = 0; in2[i]; i++)
in2[i] = '\0';
for (int i = 0; inn[i]; i++)
inn[i] = '\0';
}
}
}