結果

問題 No.970 数列変換マシン
ユーザー Kou0406
提出日時 2025-03-12 11:39:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 22 ms / 2,000 ms
コード長 405 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 71,440 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-12 11:39:22
合計ジャッジ時間 3,090 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
main.cpp:15:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     rep(i,n)scanf("%d",&y[i]),sum+=y[i];
      |             ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<cassert>
#define rep(i,n) for(i=0;i<(int)(n);i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int n;

int main(){
    int i,j,sum=0;
    scanf("%d",&n);
    vector<int> y(n),x(n);
    rep(i,n)scanf("%d",&y[i]),sum+=y[i];
    rep(i,n)x[i]=sum-(n-1)*y[i];
    rep(i,n-1)printf("%d ",x[i]);
    printf("%d\n",x[i]);
    return 0;
}
0