当前位置:   article > 正文

Caddi Programming Contest 2021(AtCoder Beginner Contest 193) --------B(暴力)_takahashi go to a pissa shop

takahashi go to a pissa shop

 

B - Play Snuke


Time Limit: 2 sec / Memory Limit: 1024 MB

Score : 200200 points

Problem Statement

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.

Constraints

  • All values in input are integers.
  • 1≤N≤1051≤N≤105
  • 1≤Ai,Pi,Xi≤1091≤Ai,Pi,Xi≤109

Input

Input is given from Standard Input in the following format:

  1. NN
  2. A1A1 P1P1 X1X1
  3. ⋮⋮
  4. ANAN PNPN XNXN

Output

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.


Sample Input 1 Copy

Copy

  1. 3
  2. 3 9 5
  3. 4 8 5
  4. 5 7 5

Sample Output 1 Copy

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.


Sample Input 2 Copy

Copy

  1. 3
  2. 5 9 5
  3. 6 8 5
  4. 7 7 5

Sample Output 2 Copy

Copy

-1

Sample Input 3 Copy

Copy

  1. 10
  2. 158260522 877914575 602436426
  3. 24979445 861648772 623690081
  4. 433933447 476190629 262703497
  5. 211047202 971407775 628894325
  6. 731963982 822804784 450968417
  7. 430302156 982631932 161735902
  8. 880895728 923078537 707723857
  9. 189330739 910286918 802329211
  10. 404539679 303238506 317063340
  11. 492686568 773361868 125660016

Sample Output 3 Copy

Copy

861648772

题解:

暴力水题,直接上代码

code:
 

  1. #include<bits/stdc++.h>
  2. #define INF 0x3f3f3f3f
  3. #define N 100003
  4. #define mod 100000
  5. #define pb push_back
  6. #define ull unsigned long long
  7. #define ll long long
  8. using namespace std;
  9. int main()
  10. {
  11. ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  12. //freopen("in.txt", "r", stdin);
  13. //freopen("out.txt", "w", stdout);
  14. ll n;
  15. cin >> n;
  16. ll a , p ,x;
  17. ll mn = INF;
  18. for(int i = 0;i < n;i++)
  19. {
  20. cin >> a >> p >> x;
  21. if(x - a > 0)
  22. mn = min(mn,p);
  23. }
  24. if(mn == INF)
  25. cout << -1 << endl;
  26. else
  27. cout << mn << endl;
  28. return 0;
  29. }

 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/52641
推荐阅读
相关标签
  

闽ICP备14008679号