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 | #include <iostream> using namespace std; bool isHan(int n) { int a, b, c; if(n < 100) return true; a = n/100; b = (n%100)/10; c = n%10; if(a-b == b-c) return true; else return false; } int main(void) { int N, result=0; cin >> N; for(int i=1; i<=N; i++) { if(isHan(i)) result++; } cout << result; return 0; } | cs |
'C & C++ > Baekjoon' 카테고리의 다른 글
백준 1152 - 단어의 개수 (0) | 2017.12.27 |
---|---|
백준 1110 - 더하기 사이클 (0) | 2017.12.27 |
백준 1008 - A/B (0) | 2017.12.27 |
백준 1003 - 피보나치 함수 (0) | 2017.12.27 |
백준 1001 - A-B (0) | 2017.12.27 |