Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
有点小水#pragma warning(disable:4996) #include <iostream> #include <stdio.h> using namespace std; int N, S; long long ans; int ci[10005], yi[10005]; int main() { scanf("%d%d", &N, &S); for (int i = 0; i < N; i++) scanf("%d%d", ci + i, yi + i); int i = 0, j; while (true) { for ( j = i; j < N && (ci[i] + (j - i)*S <= ci[j]); j++) ans += (ci[i] + (j - i)*S)*yi[j]; i = j; if (j == N) break; } cout << ans << endl; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator