Accepted
foo.cc: In function 'int main()': foo.cc:5:12: warning: unused variable 'j' [-Wunused-variable] int h,n,i,j,k,sum=0; ^ foo.cc:5:14: warning: unused variable 'k' [-Wunused-variable] int h,n,i,j,k,sum=0; ^
正在同步测试数据,请稍后 [Hydro](https://hydro.ac)提供评测服务
代码
#include<iostream>
using namespace std;
int main()
{
int h,n,i,j,k,sum=0;
cin>>h>>n;
int a[2*h];
for(i=1;i<=h;i++)
{
cin>>a[(i-1)*2]>>a[(i-1)*2+1];
}
for(i=1;i<=h;i++)
{
if(n>=a[(i-1)*2])
sum+=a[(i-1)*2+1];
}
cout<<sum;
}