VioletaBabel

1292번: 쉽게 푸는 문제 본문

백준/백준-C++
1292번: 쉽게 푸는 문제
Beabletoet 2017. 9. 4. 16:35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include<cstdio>
int main()
{
    int a, b, count = 0, limit = 1, ans = 0;
    scanf("%d %d"&a, &b);
    for (int i = 0; i < b; ++i, ++count)
    {
        if (count >= limit)
        {
            count = 0;
            ++limit;
        }
        if (i >= a - 1)
            ans += limit;
 
    }
    printf("%d", ans);
}
cs


'백준 > 백준-C++' 카테고리의 다른 글

1453번 : 피시방 알바  (0) 2017.09.04
1357번 : 뒤집힌 덧셈  (0) 2017.09.04
1159번: 농구 경기  (0) 2017.09.04
1100번: 하얀 칸  (0) 2017.09.02
1037번: 약수  (0) 2017.09.02
Comments