公式

A - Three Threes 解説 by en_translator


For beginners

Receive \(N\) as input, and print \(N\) \(N\) times using a for statement.

Since there are only nine patterns of input, one can use a if statement to implement a conditional branch, but it is wiser to use a for statement.

Sample code (C++):

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

int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++) cout << n;
  cout << endl;
}

Sample code (Python):

n = int(input())
for i in range(n):
  print(n, end = '')

投稿日時:
最終更新: