VioletaBabel
Temperatures 본문
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { int n, p = 5527, m = -5527, result; cin >> n; cin.ignore(); for (int i = 0; i < n; i++) { int t; cin >> t; cin.ignore(); if(t>0) p = (t<p) ? t : p; else m = (t>m) ? t : m; } if(p == 5527 && m == -5527) result = 0; else result = (p > (m*(-1))) ? m : p; cout << result << endl; } | cs |
'알고리즘문제들 > codingame' 카테고리의 다른 글
Power of Thor - Episode 1 (0) | 2018.02.21 |
---|---|
The Descent (0) | 2018.02.21 |