結果

問題 No.797 Noelちゃんとピラミッド
ユーザー lunnear
提出日時 2019-03-16 04:19:30
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 452 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 37,504 KB
実行使用メモリ 13,752 KB
最終ジャッジ日時 2024-07-01 22:19:15
合計ジャッジ時間 4,202 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other TLE * 1 -- * 59
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:13: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long unsigned int*’ [-Wformat=]
   11 |     scanf("%d", &n);
      |            ~^   ~~
      |             |   |
      |             |   long unsigned int*
      |             int*
      |            %ld
main.cpp:15:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long unsigned int*’ [-Wformat=]
   15 |         scanf("%d", &in);
      |                ~^   ~~~
      |                 |   |
      |                 |   long unsigned int*
      |                 int*
      |                %ld
main.cpp:27:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘__gnu_cxx::__alloc_traits<std::allocator<long unsigned int>, long unsigned int>::value_type’ {aka ‘long unsigned int’} [-Wformat=]
   27 |     printf("%d", v[0]);
      |             ~^
      |              |
      |              int
      |             %ld
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |         scanf("%d", &in);
      |         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <vector>


#define MOD (1000000007)

int main()
{
    std::vector<unsigned long> v;
    unsigned long n, in;
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &in);
        v.push_back(in);
    }
    
    for(int i = n - 1; i > 0; i--)
    {
        for(int j = 0; j < i; j++)
        {
            v[j] = (v[j] + v[j + 1]) % MOD;
        }
    }
    
    printf("%d", v[0]);
    return 0;
}
0