公式

A - Too Many Requests 解説 by en_translator


As instructed in the problem statement, for \(i=1,2,\ldots, N\), print OK if \(i\) is less than or equal to \(M\), and Too Many Requests if it is grater. This can be done by combining for and if statements.
Be sure to add a newline after each output.

Sample code in C++:

#include <bits/stdc++.h>
using namespace std;

int main(void){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		if(i<m)cout<<"OK"<<endl;
		else cout<<"Too Many Requests"<<endl;
	}
}

Sample code in Python:

n,m=map(int, input().split())

for i in range(n):
    if i<m:
        print("OK")
    else:
        print("Too Many Requests")

投稿日時:
最終更新: