当前位置:   article > 正文

2021-05-21_takahashi wants to s

takahashi wants to s

 

Takahashi wants to buy the popular video game console called Play Snuke.
There are shops that sell Play Snuke: Shop . Shop is minutes' walk from where Takahashi is now, sells Play Snuke for yen (Japanese currency), and currently has 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 at the following moments: minutes from now.
Determine whether Takahashi can buy Play Snuke. If he can, find the minimum amount of money needed to buy one.N1,2,,NiAiPiXi10.5,1.5,2.5,

  1. #include<stdio.h>
  2. int main()
  3. {
  4. int a[10000][3]={0},b[10000]={0},x=0,j=0,n,i,m;
  5. scanf("%d",&n);
  6. for(i=0;i<n;i++)
  7. {scanf("%d%d%d",&a[i][0],&a[i][1],&a[i][2]);}
  8. for(i=0;i<n;i++)
  9. {
  10. if(a[i][0]>=a[i][2])
  11. {x++;}
  12. else{
  13. b[j]=a[i][1];
  14. j++;
  15. }}
  16. if(x==n)
  17. {printf("-1");}
  18. else
  19. {
  20. m=b[0];
  21. for(i=0;i<j;i++)
  22. {
  23. if(m>b[j])
  24. m=b[j];
  25. }
  26. printf("%d",m);
  27. }
  28. }
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/52629
推荐阅读
相关标签
  

闽ICP备14008679号