QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#772894#3388. Negative People in Da HouseI_be_wannaAC ✓1ms3764kbC++11669b2024-11-22 22:41:572024-11-22 22:41:57

Judging History

你现在查看的是最新测评结果

  • [2024-11-22 22:41:57]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3764kb
  • [2024-11-22 22:41:57]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <list>
#include <set>
 
using namespace std;
 
int main()
{
    int t,n,x,y,cnt,in;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        in = cnt = 0;
        for(int i = 0; i < n; i++)
        {
            scanf("%d%d",&x,&y);
            in += x;
            if(in < y)
            {
                cnt += (y-in);
                in += (y-in);
            }
            in -= y;
        }
        printf("%d\n",cnt);
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3764kb

input:

50
100
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000
0 1000...

output:

100000
0
1550
922
1682
4917
4326
2236
3074
620
0
1963
83
6410
5713
1049
1894
342
376
3395
0
0
4855
3775
1452
4097
974
1776
1727
0
12
1733
368
4397
799
516
0
0
154
0
1992
0
941
491
4362
4712
2628
4873
3792
495

result:

ok 50 lines

Extra Test:

score: 0
Extra Test Passed