414某OJ竞赛题

D题【不知道哪里错了,一直WA】

Draw Something Cheat

 

Time Limit: 2 Seconds      Memory Limit: 65536 KB 

 

Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and draw a picture for this word. Then your friend will be asked what the word is, given the picture you have drawn. The following figure illustrates a typical scenario in guessing the word. 

 

As you see, when guessing a word you will be given the picture and 12 letters. You must pick some of these letters to form a word that matches the picture. Each letter can only be used once. It is a lot of fun if your friend is a talented painter, but unfortunately some drawings from your friend are totally incomprehensible. After several times of becoming mad by the drawings, you find a way to cheat in the game. 

In this game, letters not included in the correct answer are randomly generated. If you cannot find the correct answer when guessing, you can write down all the letters and restart the game. Then you would find some of these letters are changed. Of course these changed letters will never appear in the answer. By eliminating these letters you are a step closer to the answer. 

So In this problem, you need to write a program to automate the cheating process. Given N strings of letters to the same picture, you need to eliminate as many letters as possible, and output the remaining letters. 

Input

There are multiple test cases. The first line of the input is an integer T ≈ 1000 indicating the number of test cases. 

Each test case begins with a positive integer N ≤ 20 indicating the number of times you have entered the game. Then N lines follow. Each line is a string of exactly 12 uppercase letters, indicating the candidate letters in one guess. It is guaranteed that the answer has at least 1 letter and has no more than 12 letters. 

Output

For each test case, output the remaining letters in alphabet order after the process described above. One line for each test case. 

Sample Input

2

2

ABCDEFGHIJKL

ABCDEFGHIJKL

2

SAWBCVUXDTPN

ZQTLFJYRCGAK

Sample Output

ABCDEFGHIJKL

ACT

#include <stdio.h>
#include <string.h>
int main()
{
    int T,n,i,j,alph[26];
    char str[15];
    scanf("%d",&T);
    while (T--)
    {
        memset(alph,0,sizeof(alph));
        scanf("%d",&n);
        for (i=0;i<n;i++)
        {
            scanf("%s",str);
            for (j=0;j<12;j++)
                alph[str[j]-'A']++;
        }
        for (i=0;i<26;i++)
        {
            if (alph[i]==n)
                printf("%c",'A'+i);
        }
        printf("\n");
    }
    return 0;
}

 

J题

Modular Inverse

 

Time Limit: 2 Seconds      Memory Limit: 65536 KB 

 

The modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalent to ax≡1 (mod m). 

Input

There are multiple test cases. The first line of input is an integer T ≈ 2000 indicating the number of test cases. 

Each test case contains two integers 0 < a ≤ 1000 and 0 < m ≤ 1000. 

Output

For each test case, output the smallest positive x. If such x doesn't exist, output "Not Exist". 

Sample Input

3

3 11

4 12

5 13

Sample Output

4

Not Exist

8

#include <stdio.h>
int T,x,a,m;
int main()
{
    int i,t;
    scanf("%d",&T);
    while(T--)
    {
        x=-1;
        scanf("%d%d",&a,&m);
        for(i=0;i<1005;i++)//不知道这里要写多少,就写了个1000+
        {
            t=m*i+1;
            if(t%a==0)
            {
                x=t/a;
                break;
            }
                
        }
        if(x>0)
            printf("%d\n",x);
        else
            printf("Not Exist\n");
    }
    return 0;
}


K题

Yet Another Story of Rock-paper-scissors

 

Time Limit: 2 Seconds      Memory Limit: 65536 KB 

 

Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. Ryou, the leader of the FFF Inquisition, promised that the winner of Rock-paper-scissors would be immune from the punishment. Being lovers, Akihisa and Hideyoshi decided to die together with their fists clenched, which indicated rocks in the game. However, at the last moment, Akihisa chose paper and Hideyoshi chose scissors. As a result, Akihisa was punished by the FFF Inquisition and Hideyoshi survived alone. 

When a boy named b and a girl named g are being punished by the FFF Inquisition, they will play Rock-paper-scissors and the winner will survive. If there is a tie, then neither of they will survive. At first, they promise to choose the same gesture x. But actually, the boy wants to win and the girl wants to lose. Of course, neither of them knows that the other one may change his/her gesture. At last, who will survive? 

Input

There are multiple test cases. The first line of input is an integer T ≈ 1000 indicating the number of test cases. 

Each test case contains three strings -- b g x. All strings consist of letters and their lengths never exceed 20. The gesture x is always one of "rock", "paper" and "scissors". 

Output

If there is a tie, output "Nobody will survive". Otherwise, output "y will survive" where y is the name of the winner. 

Sample Input

1

Akihisa Hideyoshi rock

Sample Output

Hideyoshi will survive

#include <stdio.h>
char b[25],g[25],x[25];
int T;
int main()
{
    scanf("%d",&T);
    while(T--)
    {
        scanf("%s%s%s",b,g,x);
        printf("%s will survive\n",g);
    }
    return 0;
}

 

转载于:https://www.cnblogs.com/CheeseZH/archive/2012/04/14/2447424.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: 一本通 OJ 题库的测试数据,通常是用来验证提交的代码在各种情况下的正确性。测试数据可以分为两种类型,手动和自动。 手动测试数据是由题目的出题人根据题意和数据范围设计的一组数据,用来检测程序的正确性和运行效率。手动测试数据的优点是能够涵盖各种情况,但缺点是数量相对较少,不足以覆盖所有可能的情况。 自动测试数据是由程序自动生成的一组数据,可以生成大量的数据以检测程序的健壮性和效率。自动测试数据的优点是数量大且可以自动生成,但缺点是可能无法覆盖某些特殊情况,导致漏洞。 对于提交的代码,一本通 OJ 题库会对其进行编译和运行,然后与测试数据进行比较,判断代码的正确性和效率。如果代码通过了测试数据,就会被判定为正确,否则会被判定为错误,并给出具体的错误信息,供用户进行调试和改进。 综上所述,一本通 OJ 题库的测试数据是一个重要的组成部分,它可以帮助用户测试代码的正确性和运行效率,提高用户的编程技能,同时也可以帮助出题人设计更好的题目,并保证题目的质量和难度。 ### 回答2: 一本通 oj题库是一个在线的程序设计竞赛平台,提供了丰富的编程题目和测试数据。测试数据是用于对程序进行测评的输入和输出数据集合。在题目描述,会对问题进行详细的解释和要求,并提供多组测试数据作为样例,让程序员运行他们的代码,并得到程序的输出结果。 测试数据通常包括正向测试数据和反向测试数据。正向测试数据是指符合题目条件的测试数据,覆盖了大多数情况,测试程序是否正确;而反向测试数据则是用于测试程序是否能够正确处理异常情况。 在使用一本通 oj题库时,程序员不仅需要通过编写算法和程序的方式解决问题,还需要通过分析测试数据来判断自己的代码是否正确。而一本通 oj题库的丰富数据集合为程序员提供了充足的测试数据,帮助程序员准确地检测代码存在的漏洞和错误。 总之,一本通 oj题库提供了全面的测试数据来测试程序员的代码是否满足题目描述和要求,是程序员进行程序设计竞赛、算法练习和编程学习的良好平台。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值