公式

A - Print 341 解説 by en_translator


For beginners

For example, one can solve the problem by printing 1 once, and then printing 01 \(N\) times.

To do so, one has to receive the integer \(N\) from standard input, and print a desired string to standard output. Do check how to achieve input and output in your programming language.

In order to print 01 exactly \(N\) times, one can use the loop feature (like the for statement), which is a standard feature of a programming language.

The following is sample code in C++ language.

#include <iostream>
using namespace std;

int main(void)
{
  int n;
  cin >> n;
  
  cout << "1";
  for(int i = 1; i <= n; i++) cout << "01";
  cout << endl;
  
  return 0;
}

投稿日時:
最終更新: