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     

   
  • 5
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
UIUC ICPC Spring Coding Contest 2019是UIUC(伊利诺伊大学厄巴纳-香槟分校)举办的一个编程比赛。UIUC ICPC Spring Coding Contest 2019是ACM国际大学生程序设计竞赛(ACM International Collegiate Programming Contest)的一部分。ACM国际大学生程序设计竞赛是世界上最具影响力的大学生计算机竞赛之一,每年吸引了来自全球各地的大学生参与。这个比赛旨在培养学生的算法和编程技能,提供一个展示和交流的平台。参赛者需要在规定时间内解决一系列编程问题。 参加UIUC ICPC Spring Coding Contest 2019对于那些对算法和编程有兴趣的学生来说,是一个很好的学习和锻炼机会。比赛中的问题通常涉及各种算法和数据结构,要求参赛者能够用编程语言实现有效和高效的解决方案。参赛者可以通过解决问题来提高他们的算法和编程技能,并与其他参赛者交流和学习。 在准备UIUC ICPC Spring Coding Contest 2019之前,建议参赛者先掌握一些基本的编程知识和技能,如数据结构、算法、编程语言等。参赛者可以参考一些相关的教程和学习资料,如GeeksforGeeks和HackerEarth等网站提供的编程教程。此外,还可以参考一些竞赛经验分享的文章和博客,了解其他人是如何准备和参加编程比赛的。 总之,参加UIUC ICPC Spring Coding Contest 2019是一个很好的机会,可以提高算法和编程技能,与其他参赛者交流和学习。准备比赛前,建议参赛者掌握基本的编程知识和技能,并参考一些相关的教程和学习资料。祝你在比赛中取得好成绩!<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* *3* [Awesome Competitive Programming Awesome](https://blog.csdn.net/qq_27009517/article/details/86593200)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值