• 【CF1017A】The Rank(签到)


    题意:给定n个人的4门课成绩,排名按总分,保证总分互不相同,求1号名次

    n<=1e3,a[i],b[i],c[i],d[i]<=1e2

    思路:

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<string>
     4 #include<cmath>
     5 #include<iostream>
     6 #include<algorithm>
     7 #include<map>
     8 #include<set>
     9 #include<queue>
    10 #include<vector>
    11 using namespace std;
    12 typedef long long ll;
    13 typedef unsigned int uint;
    14 typedef unsigned long long ull;
    15 typedef pair<int,int> PII;
    16 typedef vector<int> VI;
    17 #define fi first
    18 #define se second 
    19 #define MP make_pair
    20 #define N   1100000
    21 #define MOD 1000000007
    22 #define eps 1e-8 
    23 #define pi acos(-1)
    24 
    25 
    26 
    27 int read()
    28 { 
    29    int v=0,f=1;
    30    char c=getchar();
    31    while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
    32    while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
    33    return v*f;
    34 }
    35 
    36 void swap(int &x,int &y)
    37 {
    38     int t=x;x=y;y=t;
    39 }
    40 
    41         
    42 int main()
    43 {
    44     //freopen("1.in","r",stdin);
    45     //freopen("1.out","w",stdout);
    46     int n,s1,s2,s3,s4;
    47     scanf("%d",&n);
    48     scanf("%d%d%d%d",&s1,&s2,&s3,&s4);
    49     int sum=s1+s2+s3+s4;
    50     //printf("%d
    ",sum); 
    51     int ans=1;
    52     for(int i=2;i<=n;i++)
    53     {
    54          int x1,x2,x3,x4;
    55          scanf("%d%d%d%d",&x1,&x2,&x3,&x4);
    56          int x=x1+x2+x3+x4;
    57          //printf("%d
    ",x);
    58          if(x>sum) ans++;
    59     }
    60     printf("%d
    ",ans);
    61     return 0;
    62 }
  • 相关阅读:
    git/github
    window 下安装MySQL
    webservice学习笔记
    Selenium 扩展功能
    Selenium API
    Selenium IDE
    Python简单爬虫
    XPath学习笔记
    selenium学习笔记(一)
    python学习笔记(网络编程)
  • 原文地址:https://www.cnblogs.com/myx12345/p/9843032.html
Copyright © 2020-2023  润新知