Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

1R/2016 07 04: Difference between revisions

From ZeroWiki
imported>vkdnjdldnjsw
No edit summary
(Repair batch-0001 pages from live compare)
 
(2 intermediate revisions by 2 users not shown)
Line 74: Line 74:
== 15이원준 ==
== 15이원준 ==
* 위와 같습니다.
* 위와 같습니다.
* 그보다 main parameter에 void해도 통과되더군요:)
* 그보다 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해도 통과되더군요 :)