zoukankan      html  css  js  c++  java
  • 2017光棍节新生训练赛

    Description

    There are some students in a class, Can you help teacher find the highest student .
     

    Input

    There are some cases. The first line contains an integer t, indicate the cases; Each case have an integer n ( 1 ≤ n ≤ 100 ) , followed n students’ height.
     

    Output

    For each case output the highest height, the height to two decimal plases;
     

    Sample Input

    2 3 170.00 165.00 180.00 4 165.00 182.00 172.00 160.00
     

    Sample Output

    180.00 182.00
     
     
     
    //水题
    #include<stdio.h>
    int main()
    {
    int a,c,k,i;
    double b;
    double MAX=0.0;
    scanf("%d",&c);
    for(k=1;k<=c;k++)
    
    {
    double max=0.0;
    scanf("%d",&a);
    for(i=1;i<=a;i++)
    {
    scanf("%lf",&b); 
    if(max<b)
    max=b;
    MAX=max;
    }
    
    printf("%.2lf
    ",MAX);
    }
    return 0;
    } 

    HDU 2567

    #include<stdio.h>
    #include<string.h>
    int main()
    {
        int i,x,y,c,d,z;
        char a[50],b[50];
        scanf("%d",&x);
        for(i=1;i<=x;i++)
        {
            scanf("%s",a);
            scanf("%s",b);
            c=strlen(a);
            d=strlen(b);
            for(z=1,y=1;y<=(c/2);y++)
            {
                a[c+d-z]=a[c-z];
                z++;
            }
            for(y=1;y<=d;y++)
                a[c/2+y-1]=b[y-1];
            a[c+d]='';
            printf("%s
    ",a);
        }
    }

    HDU 2568

    #include<stdio.h>
    int main()
    {
    int a,n;
    int A,B;
    
    scanf("%d",&a);
    
    for(int i=1;i<=a;i++)
    {
    A=0;B=0;
    scanf("%d",&n);
    while(n!=0)
    {
        
        
        if(n%2==0)   //oushu
        {A++;
        n=n/2; 
        }
        else 
        {B++;
        n=n-1;
        }
        
     } 
     printf("%d
    ",B);
    }
     
    return 0;
    
    }

    Description

    假设一堆由1分、2分、5分组成的n个硬币总面值为m分,求一共有多少种可能的组合方式(某种面值的硬币可以数量可以为0)。
     

    Input

    输入数据第一行有一个正整数T,表示有T组测试数据; 
    接下来的T行,每行有两个数n,m,n和m的含义同上。 
     

    Output

    对于每组测试数据,请输出可能的组合方式数; 
    每组输出占一行。 
     

    Sample Input

    2 3 5 4 8
     

    Sample Output

    1 2
     
     
     
    #include <stdio.h>
     
    int main()
    {
        int n, m, x, y, cnt, t, tmp, i;
        scanf("%d", &t);
        while(t--){
            scanf("%d%d", &n, &m);
            tmp = 5 * n - m;
            for(i = cnt = 0; i <= n; ++i)
                for(int j = 0; j <= n; ++j)
                    if(4*i+3*j==tmp && i+j<=n)
                        ++cnt;
            printf("%d
    ", cnt);
        }
        return 0;
    }

    HDU 5538

    #include<cstdio>  
    #include<algorithm>  
    #include<string.h>  
    #include<stdlib.h>  
    #include<math.h>  
    #define FIN freopen("in.txt","r",stdin)  
    #define eps 1e-9  
    using namespace std;  
    int mp[55][55],cnt,n,m;  
    int to[][2]={0,1,0,-1,1,0,-1,0};  
    int main(){  
        int T;  
      //  FIN;  
        scanf("%d",&T);  
        while(T--){  
            scanf("%d%d",&n,&m);  
            int top=0;  
            cnt=0;  
            for(int i=0;i<n;i++)  
                for(int j=0;j<m;j++){  
                    scanf("%d",&mp[i][j]);  
                    top=max(top,mp[i][j]);  
                    if(mp[i][j]) cnt++;  
                    cnt+=mp[i][j]*4;  
                }  
            for(int x=0;x<n;x++){  
                for(int y=0;y<m;y++){  
                    for(int i=0;i<4;i++){  
                        int xx=x+to[i][0],yy=y+to[i][1];  
                        if(xx<0||yy<0||xx>=n||yy>=m) continue;  
                        cnt-=min(mp[x][y],mp[xx][yy]);  
                    }  
                }  
            }  
            printf("%d
    ",cnt);  
        }  
        return 0;  
    }  
     
  • 相关阅读:
    Unit app.service is not loaded properly: Exec format error
    No journal files were found.
    下一代存储技术的先行: NVDIMM 你了解吗?
    How To Share Data Between the Docker Container and the Host
    perl: warning: Please check that your locale settings:
    淘宝推荐、视频搜索背后的检索技术竟是它!深度揭秘达摩院向量检索引擎Proxima
    这可能是大型复杂项目下数据流的最佳实践
    MaxCompute在电商场景中如何进行漏斗模型分析
    技术干货 | 阿里云数据库PostgreSQL 13大版本揭秘
    ACK正式支持对基于Alibaba Cloud Linux操作系统的集群进行等保加固
  • 原文地址:https://www.cnblogs.com/wuruofeng/p/7820232.html
Copyright © 2011-2022 走看看