Official
A - Too Many Requests Editorial
by
A - Too Many Requests Editorial
by
mechanicalpenciI
問題文の指示通りに \(i=1,2,\ldots, N\) について、\(i\) が \(M\) 以下ならばOK を、\(M\) より大きければ Too Many Requests を出力すれば良いです。
これは for 文と if 分の組み合わせで実装することができます。
改行することを忘れないように注意してください。
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;
}
}
Python による実装例:
n,m=map(int, input().split())
for i in range(n):
if i<m:
print("OK")
else:
print("Too Many Requests")
posted:
last update:
