結果

問題 No.131 マンハッタン距離
コンテスト
ユーザー Chi_Math
提出日時 2025-10-22 18:31:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 285 bytes
コンパイル時間 1,872 ms
コンパイル使用メモリ 194,484 KB
実行使用メモリ 11,176 KB
最終ジャッジ日時 2025-10-22 18:31:25
合計ジャッジ時間 14,500 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample TLE * 1 -- * 2
other -- * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:12: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
    6 |    scanf("%d %d %d", &x, &y, &d);
      |           ~^         ~~
      |            |         |
      |            int*      long long int*
      |           %lld
main.cpp:6:15: warning: format ‘%d’ expects argument of type ‘int*’, but argument 3 has type ‘long long int*’ [-Wformat=]
    6 |    scanf("%d %d %d", &x, &y, &d);
      |              ~^          ~~
      |               |          |
      |               int*       long long int*
      |              %lld
main.cpp:6:18: warning: format ‘%d’ expects argument of type ‘int*’, but argument 4 has type ‘long long int*’ [-Wformat=]
    6 |    scanf("%d %d %d", &x, &y, &d);
      |                 ~^           ~~
      |                  |           |
      |                  int*        long long int*
      |                 %lld
main.cpp:6:9: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |    scanf("%d %d %d", &x, &y, &d);
      |    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

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

int main() {
   long long x, y, d;
   scanf("%d %d %d", &x, &y, &d);
   
   int num = 0;
   for(int i = 0; i <= x; i++){
     for(int j = 0; j <= y; j++){
       if(i + j == d) num++;
     } 
    } 
 
   printf("%d", num);
   return 0;
} 
0