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\n",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]=‘\0‘;
        printf("%s\n",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\n",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\n", 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\n",cnt);
    }
    return 0;
}  
 
时间: 2024-07-30 22:06:49

2017光棍节新生训练赛的相关文章

郑州大学2018新生训练赛第十场题解

比赛(补题)地址:http://222.22.65.164/problemset.php 题号为:4305 -- 4309 总述:这次新生赛难度偏于平和,但涵盖方面甚广,其中一道签到题是c语言题,并且有两道是hdu一百题的原题,一道简单的最小生成树,唯一"有些难度"的应该是一道数论题(毕竟本来自己就是搞数学的).   A.沙漠骆驼 这是一道经典的递推问题,原型为HDU 2044的"一只小蜜蜂-".思路很简单,以第5个沙丘为例,到达第五个沙丘的方式有两种:从第3个向

2018-2019赛季多校联合新生训练赛第六场(2018/12/15)补题题解

A 价钱统计(基础编程能力) 这个考点还是比较个性的,怎么四舍五入 解法 常规的讲如果四舍五入整数位的话,那么只需要在后面加个0.5然后强制转换一下就可以了 这个却要我们保留一位小数的四舍五入,那该怎么做呢 实际上我们只需要把这个数乘以10然后加0.5,强制转换后再除以10就可以了 代码 #include <bits/stdc++.h> using namespace std; double trans(double a) { a*=10; a+=0.5; a=int(a); a/=10; r

2018.12.2 中国石油大学第一次新生训练赛题解

整理人: 周翔 A题:李继朋 B题:李继朋 H题:魏斯博 原文地址:https://www.cnblogs.com/QLU-ACM/p/10057831.html

Contest1592 - 2018-2019赛季多校联合新生训练赛第二场(部分题解)

D 10248 修建高楼 D 传送门 题干 题目描述 C 市有一条东西走向的"市河".C 市的市长打算在"市河"的其中一条岸边自东往西的 n 个位置(可以将这 n 个位置看成在一条直线上,且位置不会重叠)依次建造高楼. C 市的设计部门设计了 T 个方案供市长挑选(方案编号为 1 到 T).每个方案都提供了建造的每幢高楼的高度,自东向西依次为 h1,h2,h3,-,hn-1,hn.每幢楼房的高度在 1 到 n 之间(包括 1 和 n),且各不相同. 市长在挑选设计方

2018-2019赛季多校联合新生训练赛第八场(2018/12/22)补题题解

感慨 这次有点感冒,昏迷程度比较大中途还溜了 感谢 感谢qut的同学的帮助!!! A 小X与三角形(数学) 公式 两边的和-两边的差-1 因为边最小得大于两边的差,边最大得小于两边的和所以说求得是一个开区间内元素的个数 代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll a,

迎接2019多校联合新生训练赛(2018/12/31)

A 新年礼物(数学) 这个题之前cf div2刚刚考过应该都会吧.就是把左边界×2遍历一下就可以了 代码 #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ll l,r,sum=0; cin>>l>>r; for(ll i=l;i<=r;) i*=2,su

新生训练赛002题解

------------恢复内容开始------------ J 新年快乐!!! I 十进制中的二进制: 题目hkhv学长最近对二进制数很感兴趣,喜欢一切0和1组成的数.现在有一个十进制整数n,问你1到n之间有多少个数是只有0和1组成的类似二进制的数,输出他们的个数.Input输入数据包含一个数n (1 <= n <=10^9).Output输出1到n中类似二进制的数的个数.Sample Input10Sample Output2Hint对于n = 10,1 和 10是类似二进制的数. 思路:

2017后期 第 1 场训练赛

题目依次为 NKOJ 上 P3496 P4236 P3774 P2407 1.数三角形 方法很多, 比如推出三边 x y z 的限制关系, 然后加加减减得到计算式子 不过也可以用观察法, 暴力计算出 n 为 1 至 13 对应的结果为: 0 0 0 1 3 7 13 22 34 50 70 95 125 相邻两数差为: 0 0 1 2 4 6 9 12 16 20 25 30 这些相邻两数相邻差又为: 0 1 1 2 2 3 3 4 4 5 5 找到规律了, 如果结果第 i 项为第 i - 1

cumt训练赛题解

2017年4月3日 cumt2017春季--训练赛(1) A.HihoCoder 1339 (dp) 思路: 比较清晰呢,就是个dp吧.定义一下状态,dp[i][j]:前i个骰子,扔出点数和为j的方案数.然后不就很好写了嘛递推式,dp[i][j] = dp[i - 1][j - k](1<=k<=6). 好像题就做完了诶,可是窝wa了两发什么鬼.第一发爆int,第二发爆longlong,这里的trick就是方案数可能非常大,所以这题的应该把状态定义为dp[i][j]:前i个骰子,扔出点数和为j