Problem description
Question No.: | 202012-1 |
Test title: | Safety index of end of period forecast |
time limit: | 1.0s |
Memory limit: | 512.0MB |
Problem Description: | Topic backgroundThe end of the term is coming. Xiaocai found his good friend Dunton, hoping to predict whether he will fail this semester. Title DescriptionFirst of all, Dunton selected such as "classroom performance", "self-study duration", "homework score", "community activity participation", etc n This index is used as the basis for prediction. Finally, the safety index of Xiaocai students at the end of the term y It is defined as follows: among ReLU(x)=max(0,x) Is a common activation function. The importance of each indicator is known wi And corresponding scores scorei, let's calculate the safety index of Xiaocai students at the end of the term. Input formatRead in data from standard input. The first line of input contains a positive integer n. Guarantee 2≤n≤105. Next enter n Line, where The I (1 ≤ I ≤ n) line contains two integers separated by spaces wi and scorei, respectively i The importance of the item and the score of the students in the item. Output formatOutput to standard output. Output a nonnegative integer y. Indicates the safety index of the end of the period. Example 1 input6 2 60 10 100 0 70 0 0 -10 50 10 60 Data Sample 1 output1220 Data Example 1 explanationy=ReLU(1220)=1220 Example 2 Input2 -10 100 -1 15 Data Example 2 output0 Data Example 2 explanationy=ReLU(−1015)=0 |
//#include <bits/stdc++.h> #include<iostream> #include<cstdio> #include<string> #include<queue> #include<stack> #include<map> #include<vector> #include<list> #include<set> #include<iomanip> #include<cstring> #include<cctype> #include<cmath> #include<cstdlib> #include<ctime> #include<cassert> #include<sstream> #include<algorithm> using namespace std; const int mod=1e9+7; typedef long long ll; #define ls (p<<1) #define rs (p<<1|1) #define mid (l+r)/2 #define over(i,s,t) for(register long long i=s;i<=t;++i) #define lver(i,t,s) for(register long long i=t;i>=s;--i) const int MAXN = 305; const int INF = 0x3f3f3f3f; const int N=5e4+7; const int maxn=1e5+5; const double EPS=1e-10; const double Pi=3.1415926535897; //inline double max(double a,double b){ // return a>b?a:b; //} //inline double min(double a,double b){ // return a<b?a:b; //} int xd[8] = {0, 1, 0, -1, 1, 1, -1, -1}; int yd[8] = {1, 0, -1, 0, -1, 1, -1, 1}; //void Fire(){ // queue<node> p; // p.push({fx,fy,0}); // memset(fire, -1, sizeof(fire)); // fire[fx][fy]=0; // while(!p.empty()){ // node temp=p.front(); // p.pop(); // for(int i=0;i<8;i++){ // int x=temp.x+xd[i]; // int y=temp.y+yd[i]; // if(x<0||x>=n||y<0||y>=m||fire[x][y]!=-1){ // continue; // } // fire[x][y]=temp.val+1; // p.push({x,y,temp.val+1}); // } // } //} //int bfs(){ // queue<node> p; // memset(vis, 0, sizeof(vis)); // p.push({sx,sy,0}); // while (!p.empty()) { // node temp=p.front(); // vis[temp.x][temp.y]=1; // p.pop(); // for(int i=0;i<4;i++){ // int x=temp.x+xd[i]; // int y=temp.y+yd[i]; // if(x<0||x>=n||y<0||y>=m) continue; // if(x==ex&&y==ey&&temp.val+1<=fire[x][y]) return temp.val+1; // if(vis[x][y]||temp.val+1>=fire[x][y]||a[x][y]=='#') continue; // p.push({x,y,temp.val+1}); // } // } // return -1; //} int n; int sum; int a,b; int main(){ cin>>n; while (n--) { cin>>a>>b; sum+=(a*b); } if(sum<0) cout<<0; else cout<<sum; }