周赛二 简单题目汇总

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
  
415326 3262
 


 

Sample Output
  
12 10
 


 

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
  
10 Iverson 17:19 Bryant 07:03 Nash 09:33 Wade 07:03 Davies 11:13 Carter 14:28 Jordan 29:34 James 20:48 Parker 24:49 Kidd 26:46 0
 


 

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


 

Author

為傑沉倫
 


 

Source

 


 

Recommend

威士忌

 

Ac代码:

#include<stdio.h>
#include<iostream>
#include<string.h>
#include<algorithm>
using namespace std;
#define N 15
struct 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;
}
/*
5
ab 00:00
a 01:00
b 01:00
abc 01:10
aa 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 2 5 7 123 123
 


 

Sample Output
  
5 0 8
 


 

Author

YBB
 


 

Source

 


 

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;
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值