프로그래밍/문제풀이
[etc] 백준 13118 뉴턴과 사과
하용권
2019. 1. 15. 23:13
https://www.acmicpc.net/problem/13118
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #include <iostream> using namespace std; int main(){ int p[4]; int x,y,r; int ret = 0; for(int i = 0; i < 4; i++) cin >> p[i]; cin >> x >> y >> r; for(int i = 0; i < 4; i++){ if(p[i] == x) ret = i+1; } cout << ret; } | cs |
이번 문제는 많이 쉬웠습니다. 그냥 x좌표가 같은 사람의 위치를 찾으면 해결됩니다.
반응형