codeforces_813A. The Contest
来源:互联网 发布:s7200仿真软件下载 编辑:程序博客网 时间:2024/06/06 18:37
http://codeforces.com/problemset/problem/813/A
注意区分总的时间在哪个区间。
#include <iostream>using namespace std;int main(){ int first; cin>>first; int a[first]; long long sum=0; for(int i=0; i<first; i++) { cin>>a[i]; sum=sum+a[i]; } int third; cin>>third; if(third==0) { cout<<"-1"<<endl; return 0; } int b[third][2]; for(int i=0; i<third; i++) { for(int j=0; j<2; j++) { cin>>b[i][j]; } if(sum<b[i][0]) { cout<<b[i][0]<<endl;return 0; } if(sum>=b[i][0]&&sum<=b[i][1]) { cout<<sum<<endl;return 0; } } if(sum>b[third-1][1]) { cout<<"-1"<<endl; } return 0;}
阅读全文
0 0
- codeforces_813A. The Contest
- The Beauty contest game
- csu 1326 The contest
- usc oj 1615 The contest
- CodeForces 813A The Contest
- Codeforces 813 A The Contest
- Reflection2017.10.14---The Preliminary Contest
- Programming Challenges: The Programming Contest Training Manual
- The 12th Zhejiang University Programming Contest
- 省赛 The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- The Best Seat in ACM Contest
- The Android University ACM Team Selection Contest
- [ACM]The Best Seat in ACM Contest
- COJ 1326 The contest(分组背包)
- CodeForces 377 B. Preparing for the Contest
- codeforces 377B Preparing for the Contest
- matlab中gatbx工具箱的添加
- 64bit centos 如何通过yum安装32bit的程序
- slurm入门
- KdPrint 在checked 和free版本的不同
- 实训周-微信小程序-2017-06-06
- codeforces_813A. The Contest
- 10分钟理解依赖注入
- 异常处理
- RecyclerView科普--如何实现腾讯首页功能
- fb_var_screeninfo解析
- asp.net 中ascx、asmx、ashx等文件类型说明
- Java语言的特点
- 剑指Offer-27
- 递归二叉树的序列打印