B3826 题解
题目思路
定义最终答案
最后输出
代码
//By Jasoncwx
#include<bits/stdc++.h>
#define R register
#define us unsigned
#define ll long long
inline ll read(){R ll s=0,w=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')w=-1;c=getchar();}while(c>='0'&&c<='9'){s=s*10+c-'0';c=getchar();}return s*w;}
inline void print(ll x){if(x<0){putchar('-');x=-x;}if(x>=10)print(x/10);putchar(x%10+'0');return;}
using namespace std;
int main(){
int n=read(),sum=0;
while(n--){
int x=read(),t=read();
if(t)sum+=x;
else sum+=min(x,10);
}
cout<<sum;
return 0;
}