AOJ 0238 - Time to Study
AOJ 0204が通らないー
#include<iostream> #include<cstdio> int main(){ int t, n; while(std::cin >> t >> n, !std::cin.eof()){ int sum = 0; while(n--){ int s, f; std::cin >> s >> f; sum += f - s; } if(sum >= t){ puts("OK"); }else{ printf("%d\n", t-sum); } } }