标签:des style blog http color os io java ar
5 1 2 2 3 3 4 4 5 5 6 0
1419
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 #include <climits> 7 #include <vector> 8 #include <queue> 9 #include <cstdlib> 10 #include <string> 11 #include <set> 12 #include <stack> 13 #define LL long long 14 #define pii pair<int,int> 15 #define INF 0x3f3f3f3f 16 using namespace std; 17 const int maxn = 100010; 18 const LL mod = 365*24*60*60; 19 struct node{ 20 int x,y; 21 }; 22 node e[maxn]; 23 bool cmp(const node &a,const node &b){ 24 return (LL)a.x*b.y < (LL)b.x*a.y; 25 } 26 int main() { 27 int n; 28 LL ans; 29 while(scanf("%d",&n),n){ 30 for(int i = 0; i < n; i++) 31 scanf("%d %d",&e[i].x,&e[i].y); 32 sort(e,e+n,cmp); 33 ans = e[0].x; 34 for(int i = 1; i < n; i++){ 35 ans += (e[i].x + ans*e[i].y)%mod; 36 ans %= mod; 37 } 38 printf("%I64d\n",ans); 39 } 40 return 0; 41 }
标签:des style blog http color os io java ar
原文地址:http://www.cnblogs.com/crackpotisback/p/3963189.html