周赛二 简单题目汇总

来源:互联网 发布:mysql 引号转义 编辑:程序博客网 时间:2024/06/13 23:51

1、http://acm.hdu.edu.cn/showproblem.php?pid=2113

Secret Number

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7369    Accepted Submission(s): 3124


Problem Description

有一天, KIKI 收到一张奇怪的信, 信上要KIKI 计算出给定数各个位上数字为偶数的和.
eg. 5548
结果为12 , 等于 4 + 8

KIKI 很苦恼. 想请你帮忙解决这个问题.

 


 

Input

输入数据有多组,每组占一行,只有一个数字,保证数字在INT范围内.
 


 

Output

对于每组输入数据,输出一行,每两组数据之间有一个空行.
 


 

Sample Input
4153263262
 


 

Sample Output
1210
 


 

Author

kiki

 

AC代码:

#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){    int n,flag=0;    while(scanf("%d",&n)!=EOF)    {        int k,sum=0;        while(n)        {            int k=n%10;            if(k%2==0)            sum+=k;            n/=10;        }        if(flag==0)        {            printf("%d\n",sum);            flag=1;        }        else        {            printf("\n");            printf("%d\n",sum);        }    }    return 0;}


 

2、http://acm.hdu.edu.cn/showproblem.php?pid=2115

题目:

I Love This Game

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5247    Accepted Submission(s): 1810


Problem Description

Do you like playing basketball ? If you are , you may know the NBA Skills Challenge . It is the content of the basketball skills . It include several parts , such as passing , shooting , and so on. After completion of the content , the player who takes the shortest time will be the winner . Now give you their names and the time of finishing the competition , your task is to give out the rank of them ; please output their name and the rank, if they have the same time , the rank of them will be the same ,but you should output their names in lexicographic order.You may assume the names of the players are unique.

Is it a very simple problem for you? Please accept it in ten minutes.
 


 

Input

This problem contains multiple test cases! Ease test case contain a n(1<=n<=10) shows the number of players,then n lines will be given. Each line will contain the name of player and the time(mm:ss) of their finish.The end of the input will be indicated by an integer value of zero.
 


 

Output

The output format is shown as sample below.
Please output the rank of all players, the output format is shown as sample below;
Output a blank line between two cases.
 


 

Sample Input
10Iverson 17:19Bryant 07:03Nash 09:33Wade 07:03Davies 11:13Carter 14:28Jordan 29:34James 20:48Parker 24:49Kidd 26:460
 


 

Sample Output
Case #1Bryant 1Wade 1Nash 3Davies 4Carter 5Iverson 6James 7Parker 8Kidd 9Jordan 10
 


 

Author

為傑沉倫
 


 

Source

HDU 2007-10  Programming Contest_WarmUp

 


 

Recommend

威士忌

 

Ac代码:

#include<stdio.h>#include<iostream>#include<string.h>#include<algorithm>using namespace std;#define N 15struct node{    string name;    int h;    int m;    int r;}a[N];int cmp(node b,node c){    if(b.h==c.h && b.m==c.m)    return b.name<c.name;    if(b.h==c.h)    return b.m<c.m;    return b.h<c.h;}int main(){    int n,cas=0;    char ch;    while(scanf("%d",&n)!=EOF)    {        if(n==0)        break;        cas++;        if(cas!=1)        {            printf("\n");        }        for(int i=1;i<=n;i++)        {            cin>>a[i].name>>a[i].h>>ch>>a[i].m;            //scanf("%s%d:%d",a[i].name,&a[i].h,&a[i].m);        }        sort(a+1,a+n+1,cmp);        printf("Case #%d\n",cas);        //printf("%s 1\n",a[1].name);        cout<<a[1].name<<" "<<1<<endl;//        a[1].r=1;        int m=1;        for(int i=2;i<=n;i++)        {            if(a[i].h==a[i-1].h && a[i].m==a[i-1].m)            {                //printf("%s %d\n",a[i].name,a[i-1].r);                cout<<a[i].name<<" "<<m<<endl;                //a[i].r=a[i-1].r;            }            else            {                //printf("s %d\n",a[i].name,i);                cout<<a[i].name<<" "<<i<<endl;                m=i;            }        }    }    return 0;}/*5ab 00:00a 01:00b 01:00abc 01:10aa 01:10*/


 

3、http://acm.hdu.edu.cn/showproblem.php?pid=2117

Just a Numble

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2072    Accepted Submission(s): 968


Problem Description

Now give you two integers n m, you just tell me the m-th number after radix point in 1/n,for example n=4,the first numble after point is 2,the second is 5,and all 0 followed
 


 

Input

Each line of input will contain a pair of integers for n and m(1<=n<=10^7,1<=m<=10^5)
 


 

Output

For each line of input, your program should print a numble on a line,according to the above rules
 


 

Sample Input
4 25 7123 123
 


 

Sample Output
508
 


 

Author

YBB
 


 

Source

HDU 2007-10  Programming Contest_WarmUp

 


 

Recommend

威士忌

 

Ac代码:

#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;int main(){    int n,m;    while(scanf("%d%d",&n,&m)!=EOF)    {        int k=1,j=0,sum=1;        for(int i=1;i<=m+1;i++)        {            k=sum/n;            j=sum%n;            sum=j*10;        }        printf("%d\n",k);    }    return 0;}


 

0 0
原创粉丝点击