結果
| 問題 | 
                            No.1389 Clumsy Calculation
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Nachia
                         | 
                    
| 提出日時 | 2021-02-12 21:57:03 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 69 ms / 2,000 ms | 
| コード長 | 311 bytes | 
| コンパイル時間 | 2,788 ms | 
| コンパイル使用メモリ | 189,620 KB | 
| 最終ジャッジ日時 | 2025-01-18 18:28:02 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 26 | 
コンパイルメッセージ
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%lld",&N,&X);
      |   ~~~~~^~~~~~~~~~~~~~~~
main.cpp:15:17: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   rep(i,N) scanf("%lld",&A[i]);
      |            ~~~~~^~~~~~~~~~~~~~
            
            ソースコード
#include <bits/stdc++.h>
using namespace std;
using LL=long long;
using ULL=unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)
int N;
LL X;
LL A[200000];
int main(){
  scanf("%d%lld",&N,&X);
  rep(i,N) scanf("%lld",&A[i]);
  LL v=-X*(N-1);
  rep(i,N) v+=A[i];
  printf("%lld\n",v);
  return 0;
}
            
            
            
        
            
Nachia