結果
問題 | No.1389 Clumsy Calculation |
ユーザー |
![]() |
提出日時 | 2021-02-12 21:22:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 34 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 2,399 ms |
コンパイル使用メモリ | 193,708 KB |
最終ジャッジ日時 | 2025-01-18 17:53:19 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:19:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 19 | rep(i,N)scanf("%lld",&S[i]); | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <stdio.h>#include <bits/stdc++.h>using namespace std;#define rep(i,n) for (int i = 0; i < (n); ++i)#define modulo 1000000007#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)#define Inf 1000000001int main(){int N;cin>>N;long long X;cin>>X;vector<long long> S(N);rep(i,N)scanf("%lld",&S[i]);long long sum = 0LL;rep(i,N)sum += S[i];sum -= X * (N-1);cout<<sum<<endl;return 0;}