More actions
imported>vkdnjdldnjsw No edit summary |
(Repair batch-0001 pages from live compare) |
||
| (12 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
__TOC__ | __TOC__ | ||
= 오늘의 문제 = | = 오늘의 문제 = | ||
[https://www.codeground.org/practice/practiceProbView.do?probId=1|숫자 골라내기] | |||
= 참가자 = | = 참가자 = | ||
| Line 17: | Line 8: | ||
| 이름 | | 이름 | ||
| 학번 | | 학번 | ||
|- | |||
| [[박인서]] | |||
| 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해도 통과되더군요 :) | |||
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해도 통과되더군요 :)