0425 计蒜客 ICPC Greater New York Region 2019

K • Regional Team Names

题目:

A certain ICPC regional contest has specific requirements for the names of the competing teams. One of the reasons this is done is so spectators can determine which school each team is from. The requirements for a team name are specified on the website for the region as shown here:
• Each team name must consist of the institution name (greater than 1 character but less than or equal to 8 characters) followed by a hyphen (-) followed by a team name (greater than 0 characters but less than or equal to 24 characters). Please note that spaces are counted as characters. • Format: INSTITUTION-TEAMNAME INSTITUTION = University name or abbreviation. 1 < length(INSTITUTION ) <= 8. TEAMNAME = Your team name. 1 <= length(TEAMNAME) <= 24.
Write a program that determines if a supplied string is a valid team name for this region.

Input

The input consists of a single line containing a string of characters at least one character long and no more than 80 characters long. The input string will not have any leading or trailing spaces. The INSTITUTION may not contain hyphens (obviously). The TEAMNAME, however, may contain hyphens. Output

The single output line consists of the word YES if the string represents a valid team name for the region or NO if the string does not represent a valid team name for the region.

Sample 1:
Sample Input
Stevens-1
Sample Output
YES

Sample 2:
Sample Input
INSTITUTION-TEAMNAME
Sample Output
NO

Sample 3:
Sample Input
Dragons
Sample Output
NO

Sample 4:
Sample Input
VIRGTECH - Eagles
Sample Output
NO



题意:
签到:
给定一行字符,判断以 ‘-’ 分割的前半段和后半段长度是否分别在(1,8]和[1,24]的区间内,是则YES否 则NO tips:空格算作一个字符,若给定串中没有 ‘ - ’ ,则也输出NO
思路:
读入整行
%[ ],这个参数的意义是读入一个字符集合。[ ]是个集合的标志,因此%[ ]特指读入此集合所限定的 那些字符,比如%[A-Z]是输入大写字母,一旦遇到不在此集合的字符便停止。如果集合的第一个字符 是"^", 这说明读取不在"^" 后面集合的字符,遇到"^" 后面集合的字符便停止。
在这里插入图片描述
在这里插入图片描述
这位老哥讲的很详细

代码:

#include<bits/stdc++.h> using namespace std;
int main()
{   
	char a[10001];
    scanf("%[^\n]",a);
    int l=strlen(a),pos=-1;
    for(int i=0;i<l;i++)
    	if(a[i]=='-')pos=i;
    if(pos==-1){cout<<"NO"<<endl;return 0;}
    if(!(pos>1 && pos<=7) && !(l-pos>2 && l-pos<24))
    {cout<<"NO"<<endl;return 0;}
    cout<<"YES"<<endl; 
    return 0;
      }          

H • ProblematicPublicKeys

题目:
On February 15, 2012, the New York Times reported a flaw in the method of generating keys for a public-key encryption system (“Researchers Find a Flaw in a Widely Used Online Encryption Method" by John Markoff). This flaw enables an attacker to determine private keys given a set of flawed public keys.
Your job is to write a program that takes flawed public keys and determines the corresponding private keys. For the purposes of this problem, a private key consists of a pair of prime numbers,

2 < K1,K2 < 2^31

and the corresponding public key consists of the product K1 * K2.

Input
The first line of the input contains an integer value, M (2 <= M <= 100). M is the number of input lines that follow. Each of the M lines contains a single “public key." Each public key is the product of exactly two prime numbers and will fit in a 32-bit unsigned integer.

Output
The output lines produced by your program should contain the unique prime factors of the input data values in ascending numeric order, five per line, except for the last line. Output values on the same line are separated by a single space.

样例输入1
6
221
391
713
1457
901
299
样例输出1
13 17 23 31 47
53
样例输入2
2
2143650557
2140117121
样例输出2
32717 65413 65521



题意:
建设中
思路:
建设中

代码:



NULL     

   
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值