結果

問題 No.796 well known
ユーザー lunnear
提出日時 2019-05-02 16:09:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 6 ms / 2,000 ms
コード長 348 bytes
コンパイル時間 567 ms
コンパイル使用メモリ 22,784 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-31 13:31:43
合計ジャッジ時間 1,500 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    
    if(n % 3 == 2)
    {
        printf("3");
        n -= 1;
    }
    else if(n % 3 == 1)
    {
        printf("3 3 3");
        n -= 3;
    }
    else
    {
        printf("3 3");
        n -= 2;
    }
    
    for(; n > 0; n--)
        printf(" 1");
    
    printf("\n");
}
0