AOJ 0238 Time to Study

問題文

Time to Study

感想

読みやすいこともない。

解法

素直に実装する。

ソース

ふつう。

#include <iostream>
#include <cstdio>
using namespace std;
 
int main(){
    int t;
    while(cin >> t && t){
        int n;
        cin >> n;
        int s = 0;
        for(int i = 0 ; i < n; i++){
            int a,b;
            cin >> a >> b;
            s += b-a;
        }
        if( s >= t ){
            cout << "OK" << endl;
        }else{
            cout << t - s << endl;
        }
    }
}