結果

問題 No.254 文字列の構成
ユーザー kroton
提出日時 2015-07-15 11:05:44
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 402 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 23,040 KB
実行使用メモリ 489,904 KB
最終ジャッジ日時 2024-07-08 08:03:11
合計ジャッジ時間 25,742 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 12 WA * 2 OLE * 2 -- * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:14:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |   scanf("%d", &N);
      |   ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <cstdio>
using namespace std;

const int BUFSIZE = 500000020;
char buf[BUFSIZE+1];

int main(){
  for(int i=0;i<BUFSIZE;i++){
    buf[i] = (i % 26) + 'a'; 
  }
  buf[BUFSIZE] = '\0';

  int N;
  scanf("%d", &N);

  while(N >= BUFSIZE){
    printf("%s", buf);
    N -= BUFSIZE;
  }
  
  for(int i=0;i<N;i++){
    buf[i] = (i % 26) + 'a';
  }
  buf[N] = '\0';
  printf("%s", buf);

  return 0;
}
0