Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 두 동전
- 17837
- Jenknis
- IntelliJ
- 큐빙
- activity
- broadcastreceiver
- git
- 데이터전달
- 알고리즘
- 16197
- insert
- mysql
- Android
- intent
- 백준
- 프로그래머스
- Java
- 단축키
- 제어반전
- vscode
- goland
- 데이터
- data
- spring
- ubuntu
- github
- Algorithm
- 안드로이드
- service
Archives
- Today
- Total
해보자
백준_1193_분수 찾기 본문
#include <iostream>
using namespace std;
int N;
int main() {
cin >> N;
int child, parent;
int num = 0;
int i = 0;
bool flag = true;
while(flag){
num++;
for (child = 1, parent = num; child <= num; child++, parent--) {
if (++i >= N) {
flag = false;
break;
}
}
}
if (num%2 == 0) cout << child << "/" << parent;
else cout << parent << "/" << child;
return 0;
}
'C++ > Solve & Think' 카테고리의 다른 글
백준_1929_소수 구하기 (0) | 2020.11.25 |
---|---|
백준_14499_주사위굴리기 (0) | 2020.11.24 |
백준_5373번_큐빙 (0) | 2020.11.24 |
백준_17837번_새로운게임2 (0) | 2020.10.10 |
백준_16236번_아기상어 (0) | 2020.10.09 |