#define l(x) s[0]=b/10+48;s[1]=b%10+48;write(1,s,x);__libc_start_main(){ char s[9]; int p=-1,a,b; read(0,s,9); a=10*(s[0]-48)+s[1]-48; b=10*(s[3]-48)+s[4]-48; a=3600*a+60*(b-a)-b; s[2]=58; b=a/3600;l(3) b=a%3600/60;l(3) b=a%60;l(2) _Exit(0);}main; 풀이 : 문자열 문자열로 입력을 받고 정수로 변환 한 다음 계산한다. 위의 c언어 코드는 아래의 pascal 코드로 만든 것var s:string;a,b,c:int64;begina:=0;b:=0;readln(s);a..
__libc_start_main(){ char s[100000]; //입력을 받기위한 배열 long long a[3],b,c,k,p=-1; //a[]는 a_i, b_i, c_i, b는 a[]용 index, c는 정답, p는 입력데이터를 읽기위한 index read(0,s,100000); //입력 while(s[++p]>32); //문제에서의 n, 이 코드에선 n을 쓰지 않으니 그냥 넘어간다. while(s[++p]>32){k*=10;k+=s[p]+-48;} //k 계산 while(s[++p]) { //a_i, b_i, c_i 입력받고 계산, s[++p]의 값이 0(이 칸부터 입력이 없었다는 의미!)이면 종료 if(s[p]>32){a[b]*=10;a[b]+=s[p]-48;..
https://www.acmicpc.net/problem/35423__libc_start_main(){ char s[60000],x[6]="SciCom",y[4]="Love"; int a,t,b,n;a=n=0; while(t=read(0,s,60000)){ n+=t; while(t--)if(s[t]==76)++a; } b=(n-4*a)/6; for(n=0;n1e4){write(1,s,60000);b-=1e4;} if(b)write(1,s,6*b); for(n=0;n15e3){write(1,s,60000);a-=15e3;} if(a)write(1,s,4*a); _Exit(0);}main; 풀이 : 구현, 문자열 ..
#include int main(void) { int n,f=0,a=0,c=0; scanf("%d",&n); char s[n+1]; scanf("%s",s); for(int i=0;i=0;i--) { if(s[i]=='B') f=1; if(f==1 && s[i]=='R') ++a; } if(a && a=0;i--) { if(s[i]=='R') f=1; if(f==1 && s[i]=='B') ++a; } if(a && a 풀이 : 그리디? 1. 왼쪽에서 출발, 오른쪽에서 출발 2가지 경우2. 여기서 B 가 발견 된 다음 이후 나머지 A를 옮기는 경우, A가 발견된 다음 나머지 B를 옮기는 경우 총 4가지 경우를 고려하면 됩니다. 그 중 가장 최솟값을 출력하면 됩니다. https://www.acm..
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. 문제에서 말하는..
- Total
- Today
- Yesterday
- PASCAL
- 브루트포스
- Lazy Propagation
- XOR
- 누적합
- 문자열
- 백준
- 스택
- 세그먼트 트리
- Segment Tree
- C++
- 오프라인 쿼리
- 1835
- 구현
- 그리디
- 기하학
- Krustal
- union
- 정렬
- DP
- DFS
- java
- C언어
- 그래프
- BFS
- 최소 스패닝 트리
- find
- 누적 합
- 1835번
- 덱
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
