More actions
No edit summary |
(Repair batch-0001 pages from live compare) |
||
| (7 intermediate revisions by 3 users not shown) | |||
| Line 41: | Line 41: | ||
} | } | ||
== 이원준 == | |||
#include <stdio.h> | |||
int main(void) { | |||
setbuf(stdout, NULL); | |||
int TC; | |||
int test_case; | |||
scanf("%d", &TC); | |||
for (test_case = 1; test_case <= TC; test_case++) { | |||
int n; | |||
int temp; | |||
int ans = 0; | |||
scanf("%d", &n); | |||
for (int i = 0; i < n; i++){ | |||
scanf("%d", &temp); | |||
ans ^= temp; | |||
} | |||
printf("Case #%d\n", test_case); | |||
printf("%d\n", ans); | |||
} | |||
return 0; | |||
} | |||
= 아이디어 = | = 아이디어 = | ||
== 박인서 == | == 박인서 == | ||
* 같은 수를 짝수 번 XOR하면 0이 된다는 아이디어를 이용 | * 같은 수를 짝수 번 XOR하면 0이 된다는 아이디어를 이용 | ||
== 15이원준 == | |||
* 위와 같습니다. | |||
* 그보다 main parameter에 void해도 통과되더군요 :) | |||
Latest revision as of 23:55, 26 March 2026
오늘의 문제
참가자
| 이름 | 학번 |
| 박인서 | 15학번 |
| 15이원준 | 15학번 |
코드
박인서
#include <cstdio>
int main(int argc, char** argv) {
setbuf(stdout, NULL);
int TC;
int test_case;
scanf("%d", &TC);
for(test_case = 1; test_case <= TC; test_case++) {
int n, x=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
int t;
scanf("%d",&t);
x=x^t;
}
printf("Case #%d\n", test_case);
printf("%d\n", x);
}
return 0;
}
이원준
#include <stdio.h>
int main(void) {
setbuf(stdout, NULL);
int TC;
int test_case;
scanf("%d", &TC);
for (test_case = 1; test_case <= TC; test_case++) {
int n;
int temp;
int ans = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++){
scanf("%d", &temp);
ans ^= temp;
}
printf("Case #%d\n", test_case);
printf("%d\n", ans);
}
return 0;
}
아이디어
박인서
- 같은 수를 짝수 번 XOR하면 0이 된다는 아이디어를 이용
15이원준
- 위와 같습니다.
- 그보다 main parameter에 void해도 통과되더군요 :)