赞
踩
B - Play Snuke
Time Limit: 2 sec / Memory Limit: 1024 MB
Score : 200200 points
Takahashi wants to buy the popular video game console called Play Snuke.
There are NN shops that sell Play Snuke: Shop 1,2,…,N1,2,…,N. Shop ii is AiAi minutes' walk from where Takahashi is now, sells Play Snuke for PiPi yen (Japanese currency), and currently has XiXi Play Snukes in stock.
Now, Takahashi will go to one of those shops on foot and buy Play Snuke if it is still in stock when he gets there.
However, Play Snuke is so popular that the number of consoles in stock (if any) in every shop will decrease by 11 at the following moments: 0.5,1.5,2.5,…0.5,1.5,2.5,… minutes from now.
Determine whether Takahashi can buy Play Snuke. If he can, find the minimum amount of money needed to buy one.
Input is given from Standard Input in the following format:
- NN
- A1A1 P1P1 X1X1
- ⋮⋮
- ANAN PNPN XNXN
If Takahashi can buy Play Snuke, print the minimum amount of money needed to buy one, as an integer.
If he cannot buy one, print -1.
Copy
- 3
- 3 9 5
- 4 8 5
- 5 7 5
Copy
8
If he goes to Shop 11, it will still have 22 Play Snukes when he gets there, and he can buy one for 99 yen.
If he goes to Shop 22, it will still have 11 Play Snuke when he gets there, and he can buy one for 88 yen.
If he goes to Shop 33, Play Snuke will be out of stock when he gets there; he cannot buy one.
Copy
- 3
- 5 9 5
- 6 8 5
- 7 7 5
Copy
-1
Copy
- 10
- 158260522 877914575 602436426
- 24979445 861648772 623690081
- 433933447 476190629 262703497
- 211047202 971407775 628894325
- 731963982 822804784 450968417
- 430302156 982631932 161735902
- 880895728 923078537 707723857
- 189330739 910286918 802329211
- 404539679 303238506 317063340
- 492686568 773361868 125660016
Copy
861648772
题解:
暴力水题,直接上代码
code:
- #include<bits/stdc++.h>
- #define INF 0x3f3f3f3f
- #define N 100003
- #define mod 100000
- #define pb push_back
- #define ull unsigned long long
- #define ll long long
- using namespace std;
- int main()
- {
- ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
- //freopen("in.txt", "r", stdin);
- //freopen("out.txt", "w", stdout);
- ll n;
- cin >> n;
-
- ll a , p ,x;
- ll mn = INF;
- for(int i = 0;i < n;i++)
- {
- cin >> a >> p >> x;
- if(x - a > 0)
- mn = min(mn,p);
- }
- if(mn == INF)
- cout << -1 << endl;
- else
- cout << mn << endl;
- return 0;
- }
-
-

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。