백준/백준-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 |