結果
問題 | No.633 バスの運賃 |
ユーザー |
![]() |
提出日時 | 2018-01-19 21:37:28 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 682 bytes |
コンパイル時間 | 1,543 ms |
コンパイル使用メモリ | 158,328 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-24 12:27:35 |
合計ジャッジ時間 | 2,072 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<n;i++) #define REPR(i,n) for(int i=n;i>=0;i--) #define FOR(i,m,n) for(int i=m;i<n;i++) #define EPS (1e-7) typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<double,double> pdd; int vx[]={0,1,0,-1}; int vy[]={1,0,-1,0}; int dx[]={1,0,-1,1,-1,1,0,-1}; int dy[]={1,1,1,0,0,-1,-1,-1}; const ll mod=1e9+7; const int INF=INT_MAX/2; const int MAX=1e9; int main(){ int n; cin>>n; int a[n-1]; REP(i,n-1)cin>>a[i]; int b[n],c[n]; REP(i,n)cin>>b[i]>>c[i]; int pn[n]; int p=0; int ans=0; REP(i,n-1){ p+=c[i]-b[i]; ans+=a[i]*p; } cout<<ans<<endl; return 0; }