Problem B: 七龙珠II

Description

小王去找了个算命先生算算这辈子是有钱还是没钱。他在纸上写下“性命”两个字,问哪个字重要。

小王想了想说当然是命比较重要。

他摇摇头:“你,没钱”

“为什么?”

“有钱,任性。没钱,认命。”

小王问大师,我想要很多钱,还望大师指点。

大师:世间有七个珠子,只要集齐就可以实现你的愿望。

小王:哦,大师,这个段子我看的太多了,你一定说不是七龙珠,是双色球。

大师:滚特么犊子!我说的是超级大乐透!

超级大乐透一注7个号码,分为前区5个1到35号的球,后区2个1到12号的球,前区5个球都不相同,后区2个球也不相同,摇号时先摇

出前区5球,再摇后区2球。当然摇号时球不一定是有序的,你买的时候也一样可能无序,不过都是先前区后后区

Input

多组测试数据。先输入1个整数t表示组数,然后是t组,每组输入2行,分别是摇出的号码和你买的号码

Output

对于每组测试数据输出1行,如果全中输出yes,否则输出no

Sample Input

2
1 2 3 4 5 5 6
1 2 3 4 5 5 6
1 2 3 35 5 2 3
1 2 3 5 35 3 2

Sample Output

yes
yes
#include<stdio.h>
int main(void)
{
    int t;
    int a[100],b[100];
    int i,j,count=0,s=0;
    while(scanf("%d",&t)!=EOF)
    {
        while(t--)
        {
            for(i=0;i<7;i++)
            scanf("%d",&a[i]);
            for(i=0;i<7;i++)
            scanf("%d",&b[i]);
            for(i=0;i<5;i++)
            for(j=0;j<5;j++)
            {
                if(a[i]==b[j])
                count++;
            }
            if(count==5)
            {
                if((a[5]==b[5]&&a[6]==b[6])||(a[5]==b[6]&&a[6]==b[5]))
                printf("yes\n");
                else
                printf("no\n");
            }
            else
            printf("no\n");
            count=0;
        }
        return 0;
    }
}

原文地址:https://www.cnblogs.com/chenlong991223/p/10209228.html

时间: 2024-10-18 05:17:19

Problem B: 七龙珠II的相关文章

Problem Path Sum II

Problem Description: Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Solution: 递归. 1 public List<List<Integer>> pathSum(TreeNode root, int sum) { 2 List<List<Integer>> list = n

Problem Word Break II

Problem Description: Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such possible sentences. For example, givens = "catsanddog",dict = ["cat&qu

Problem Single Number II

Problem Description: Given an array of integers, every element appears three times except for one. Find that single one. Solution: 1 Arrays.sort(A); 2 for (int i = 2; i < A.length; i += 3) { 3 if (A[i] != A[i-2]) { 4 return A[i-2]; 5 } 6 } 7 8 return

LeetCode Problem 90. Subsets II

python solution 123456789101112131415161718192021222324252627 class (object): def subsetsWithDup(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ """ 思路整理:DFS recursion 1)对nums进行排序以避免nums中重复元素

fzu1901Period II

地址:http://acm.fzu.edu.cn/problem.php?pid=1901 题目: Problem 1901 Period II Accept: 442    Submit: 1099Time Limit: 1000 mSec    Memory Limit : 32768 KB  Problem Description For each prefix with length P of a given string S,if S[i]=S[i+P] for i in [0..SI

UVa11030-Predator II

Problem D Predator II Time limit: 2 seconds Oh No!!! The predator has entered the room again. But this time it is a different kind of room. The room is a square of size 10000 X 10000. There are several compartments of different shapes and sizes, situ

Uva 10599 - Robots(II) (dp + 记录路径)

Problem K Robots(II) Time Limit 1 Second Your company provides robots that can be used to pick up litter from fields after sporting events and concerts. Before robots are assigned to a job, an aerial photograph of the field is marked with a grid. Eac

[LeetCode] Permutations

Well, have you solved the nextPermutation problem? If so, your code can be used in this problem. The idea is fairly simple: sort nums in ascending order, add it to res; generate the next permutation of nums using nextPermutation(), and add it to res;

CFA一级知识点总结

Ethics 部分 Objective of codes and standard:永远是为了maintain public trust in 1. Financial market 2. Investment profession 6个code of ethics 1. Code 1—ethics and pertinent d persons a. 2. Code 2---primacy of client’s interest a. Integrity with investment pr