var a,b,c,d:word;beginrepeatread(a,b,c,d);if a+b+c+d=0 then break;if a+b=3 then a:=0else if ab then if a>b then a:=90-a*10-b else a:=90-b*10-aelse a:=7-a;if c+d=3 then c:=0else if cd then if c>d then c:=90-c*10-d else c:=90-d*10-celse c:=7-c;if a=c then writeln('Tie.') else begin if a 풀이 : 구현, 많은 조건 분기 입력받은 값에 대해서 문제 조건에 맞추어 tier를 부여한 다음,tier가 같다면 Tie.다르다면 더욱 tier 숫자가 낮은 쪽이 이겼다고 출력했습니다. 1,2 2..
var a,b,c,d:word;beginrepeatread(a,b,c,d);if a+b+c+d=0 then break;if a+b=3 then a:=0else if ab then if a>b then a:=90-a*10-b else a:=90-b*10-aelse a:=7-a;if c+d=3 then c:=0else if cd then if c>d then c:=90-c*10-d else c:=90-d*10-celse c:=7-c;if a=c then writeln('Tie.') else begin if a 풀이 : 구현, 많은 조건 분기 입력받은 값에 대해서 문제 조건에 맞추어 tier를 부여한 다음,tier가 같다면 Tie.다르다면 더욱 tier 숫자가 낮은 쪽이 이겼다고 출력했습니다. 1,2 2..
uses math;var s:string;x,y,c,a,b:real;n,m:int64;beginreadln(n,x,y);repeatn-=1;if n=0 then break;readln(s);m:=length(s);c:=1;a:=0;while s[m]' 'do begin a+=c*(ord(s[m])-48); m-=1; c*=10;end;b:=a/sqrt(2);if s[1]='N'then begin if s[2]='E'then begin x+=b;y+=b;end else if s[2]='W'then begin x-=b;y+=b;end else y+=a;endelse if s[1]='S'then begin if s[2]='E'then begin x+=b;y-=b;end else if s[2]='W'then b..
var n,a,b,c,d,e:int64;beginread(n,a,b);d:=0;e:=0;repeatn-=1;read(c);if c=a then d:=1;if c=b then e:=1;until n=1;if e+d=0 then write(-1)else if(d=1)and(e=0)then write(b)else if(d=0)and(e=1)then write(a)else for n:=a to b do write(n,' ');end. 풀이 : 많은 조건 분기? 1. 최소값, 최댓값이 입력되었다면 a~b 전부를 출력합니다.2. 최소값만 입력되었다면 최댓값을 출력합니다.3. 최댓값만 입력되었다면 최솟값을 출력합니다.4. 둘 다 입력되지 않았다면 기억이 잘못된것이므로 -1 을 출력합니다.
var s:string;a,b:int64;beginreadln(s);a:=(ord(s[6])-48)*10+ord(s[7])-48;b:=(ord(s[9])-48)*10+ord(s[10])-48;if((a=3)and(b>20))or((a=4)and(b19))or((a=5)and(b20))or((a=6)and(b20))or((a=7)and(b22))or((a=8)and(b22))or((a=9)and(b22))or((a=10)and(b22))or((a=11)and(b22))or((a=12)and(b21))or((a=1)and(b19))or((a=2)and(b18))or((a=3)and(b 풀이 : 구현, 많은 조건 분기 1. year 는 무시하고, month 와 day를 입력에서 받아옵니다.2. 문제에서 말하는..
var a,b,x,y,z:int64;beginread(a,b);if a=0 then write(0)else if ab then begin write(a div b,' '); x:=b;a:=a mod b;y:=a;z:=y; while 1=1 do begin if x mod y = 0 then break else begin z:=x mod y; x:=y mod x;y:=z;end; end; write(a div z,'/',b div z);end;end. 풀이 : 많은 조건 분기, 유클리드 호제법 1. numerator 가 0 인 경우 -> 0 출력2. numerator 최대공약수를 구한 다음 기약분수 꼴로 출력3. numerator == denominator 인 경우 -> 몫을 출력4. n..
var t,n,m,i,j,a,b:word;s:string;beginreadln(t);j:=0;repeatreadln(n);readln(s);j+=1;m:=length(s)-4;a:=0;b:=0;i:=1;while i 풀이 's', 'h', 'e', 'e', 'p', ' ' 또는 's', 'h', 'e', 'e', 'p', \0 의 개수를 구하는 문제입니다. b 가 0 이면, 특정 단어가 찾고자 하는 건지 판단합니다!아니라면 b=1로 바꾸고 새로운 단어가 온다는 것을 알려주는 ' ' (공백, blank) 문자가 올때까지 i 을 1씩 증가시킵니다.' '을 만나면 다시 b=0으로 바꾼다음 새로운 문자가 찾고자 하는게 맞는지 판단합니다. 주의 할 점 : 띄어쓰기 2줄!!!, sheepsheep 이건 shee..
var n,i:word;a,d:array[0..999]of word;beginread(n);for i:=0 to 999 do d[i]:=0; for i:=1 to n do begin read(a[i]);d[a[i]]+=1;end;for i:=1 to 999 do d[i]+=d[i-1];for i:=1 to n do writeln(1+d[a[i]-1]);end. 먼저 들어온대로 순서를 매기는 문제입니다.단 동시에 들어온 경우 (ex 1등 2명, 2등 1명)2등은 존재하지 않으며 3등이 됩니다. 풀이1. 배열 a는 입력받은 수를 순서대로 저장, 배열 d는 1~1000 수가 얼마나 입력됬는지를 저장2. d[i] += d[i-1] 을 반복합니다 (누적합), 이것을 해야 자신 앞에 얼마나 많이 있는지 확인이 가능..
var a,b,c,d:int64;begind:=0;read(a,b,c);if (c mod 2)=1 then c-=1;if b=0 then d:=3*c div 2else if c>1 then begin d:=(b-1)*2+5; d+=3*(c-2)div 2;end;if a>0 then d+=a*2;write(d);end. 풀이 1. Corner 블럭 짝수개를 취합니다.2. S-tile 은 Corner 블럭이 2개가 있다면 연결할 수 있습니다. 중요한것은 Corner 블럭 2개가 있다면 반드시 그 사이에 S-tile 블럭을 끼어넣는것이 좋습니다.또한 S-tile 끼리 서로 연결한 다음 양 끝쪽에 Corner을 붙이면 됩니다. (S-tile - 1)*2 + 5 만큼 증가시켜줍니다.만약 짝수개의 Corner ..
- Total
- Today
- Yesterday
- DFS
- 구현
- 누적 합
- 최소 스패닝 트리
- Segment Tree
- 그래프
- 덱
- C++
- 문자열
- union
- 오프라인 쿼리
- 브루트포스
- 1835
- 정렬
- Lazy Propagation
- XOR
- BFS
- Krustal
- find
- DP
- C언어
- 누적합
- 스택
- 1835번
- java
- PASCAL
- 세그먼트 트리
- 기하학
- 백준
- 그리디
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
