博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cf411(A,B,C)
阅读量:5279 次
发布时间:2019-06-14

本文共 8053 字,大约阅读时间需要 26 分钟。

A. Password Check
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

You have probably registered on Internet sites many times. And each time you should enter your invented password. Usually the registration form automatically checks the password's crypt resistance. If the user's password isn't complex enough, a message is displayed. Today your task is to implement such an automatic check.

Web-developers of the company Q assume that a password is complex enough, if it meets all of the following conditions:

  • the password length is at least 5 characters;
  • the password contains at least one large English letter;
  • the password contains at least one small English letter;
  • the password contains at least one digit.

You are given a password. Please implement the automatic check of its complexity for company Q.

Input

The first line contains a non-empty sequence of characters (at most 100 characters). Each character is either a large English letter, or a small English letter, or a digit, or one of characters: "!", "?", ".", ",", "_".

Output

If the password is complex enough, print message "Correct" (without the quotes), otherwise print message "Too weak" (without the quotes).

Sample test(s)
input
abacaba
output
Too weak
input
X12345
output
Too weak
input
CONTEST_is_STARTED!!11
output
Correct

水题。。

#include 
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;int main(){ char a[105]; cin>>a; int l=strlen(a); if(l>=5) { bool al=0,au=0,ad=0; for(int i=0;i
='a'&&a[i]<='z') al=1; else if(a[i]>='A'&&a[i]<='Z') au=1; else if(a[i]>='0'&&a[i]<='9') ad=1; if(al==0||au==0||ad==0) cout<<"Too weak"<
B. Multi-core Processor
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

The research center Q has developed a new multi-core processor. The processor consists of n cores and has k cells of cache memory. Consider the work of this processor.

At each cycle each core of the processor gets one instruction: either do nothing, or the number of the memory cell (the core will write an information to the cell). After receiving the command, the core executes it immediately. Sometimes it happens that at one cycle, multiple cores try to write the information into a single cell. Unfortunately, the developers did not foresee the possibility of resolving conflicts between cores, so in this case there is a deadlock: all these cores and the corresponding memory cell are locked forever. Each of the locked cores ignores all further commands, and no core in the future will be able to record an information into the locked cell. If any of the cores tries to write an information into some locked cell, it is immediately locked.

The development team wants to explore the deadlock situation. Therefore, they need a program that will simulate the processor for a given set of instructions for each core within m cycles . You're lucky, this interesting work is entrusted to you. According to the instructions, during the m cycles define for each core the number of the cycle, during which it will become locked. It is believed that initially all cores and all memory cells are not locked.

Input

The first line contains three integers nmk (1 ≤ n, m, k ≤ 100). Then follow n lines describing instructions. The i-th line contains mintegers: xi1, xi2, ..., xim (0 ≤ xij ≤ k), where xij is the instruction that must be executed by the i-th core at the j-th cycle. If xij equals 0, then the corresponding instruction is «do nothing». But if xij is a number from 1 to k, then the corresponding instruction is «write information to the memory cell number xij».

We assume that the cores are numbered from 1 to n, the work cycles are numbered from 1 to m and the memory cells are numbered from 1 to k.

Output

Print n lines. In the i-th line print integer ti. This number should be equal to 0 if the i-th core won't be locked, or it should be equal to the number of the cycle when this core will be locked.

Sample test(s)
input
4 3 51 0 01 0 22 3 13 2 0
output
1130
input
3 2 21 21 22 2
output
110
input
1 1 10
output
0

#include 
using namespace std;int x[105][105],time[105],n,m,k,cnt[105];bool locked[105];int main(){ scanf("%d %d %d",&n,&m,&k); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) scanf("%d",&x[i][j]); for(int i=1;i<=m;i++){ for(int j=1;j<=k;j++) cnt[j]=0; for(int j=1;j<=n;j++) if(time[j]==0 && x[j][i]>0 && !locked[x[j][i]]) cnt[x[j][i]]++; for(int j=1;j<=k;j++) if(cnt[j]>1) locked[j]=1; for(int j=1;j<=n;j++) if(time[j]==0 && x[j][i]>0 && locked[x[j][i]]) time[j]=i; } for(int i=1;i<=n;i++) printf("%d\n",time[i]); return 0;}

C. Kicker
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Kicker (table football) is a board game based on football, in which players control the footballers' figures mounted on rods by using bars to get the ball into the opponent's goal. When playing two on two, one player of each team controls the goalkeeper and the full-backs (plays defence), the other player controls the half-backs and forwards (plays attack).

Two teams of company Q decided to battle each other. Let's enumerate players from both teams by integers from 1 to 4. The first and second player play in the first team, the third and the fourth one play in the second team. For each of the four players we know their game skills in defence and attack. The defence skill of the i-th player is ai, the attack skill is bi.

Before the game, the teams determine how they will play. First the players of the first team decide who will play in the attack, and who will play in the defence. Then the second team players do the same, based on the choice of their opponents.

We will define a team's defence as the defence skill of player of the team who plays defence. Similarly, a team's attack is the attack skill of the player of the team who plays attack. We assume that one team is guaranteed to beat the other one, if its defence is strictly greater than the opponent's attack and its attack is strictly greater than the opponent's defence.

The teams of company Q know each other's strengths and therefore arrange their teams optimally. Identify the team that is guaranteed to win (if both teams act optimally) or tell that there is no such team.

Input

The input contain the players' description in four lines. The i-th line contains two space-separated integers ai and bi (1 ≤ ai, bi ≤ 100) — the defence and the attack skill of the i-th player, correspondingly.

Output

If the first team can win, print phrase "Team 1" (without the quotes), if the second team can win, print phrase "Team 2" (without the quotes). If no of the teams can definitely win, print "Draw" (without the quotes).

Sample test(s)
input
1 100100 199 9999 99
output
Team 1
input
1 12 23 32 2
output
Team 2
input
3 32 21 12 2
output
Draw
Note

Let consider the first test sample. The first team can definitely win if it will choose the following arrangement: the first player plays attack, the second player plays defence.

Consider the second sample. The order of the choosing roles for players makes sense in this sample. As the members of the first team choose first, the members of the second team can beat them (because they know the exact defence value and attack value of the first team).

超简单博弈啊。。。

#include 
#include
#include
#include
#include
#include
using namespace std;typedef long long ll;struct data{ int d1,a1,d2,a2;}a,b;int main(){ cin>>a.d1>>a.a1>>a.d2>>a.a2>>b.d1>>b.a1>>b.d2>>b.a2; int aa,ad; if(a.a1+a.d2>a.a2+a.d1) aa=a.a1,ad=a.d2; else if(a.a1+a.d2
abs(a.a2-a.d1)) aa=a.a1,ad=a.d2; else aa=a.a2,ad=a.d1; } //cout<
<<' '<
<
ad&&b.d2>aa)||(b.a2>ad&&b.d1>aa)) cout<<"Team 2"<

转载于:https://www.cnblogs.com/martinue/p/5490479.html

你可能感兴趣的文章
数据库01 /Mysql初识以及基本命令操作
查看>>
数据库02 /MySQL基础数据类型以及多表之间建立联系
查看>>
Python并发编程04/多线程
查看>>
CF461B Appleman and Tree
查看>>
CF219D Choosing Capital for Treeland
查看>>
杂七杂八的小笔记本
查看>>
51Nod1353 树
查看>>
CF1215E Marbles
查看>>
BZOJ2339 HNOI2011卡农(动态规划+组合数学)
查看>>
octave基本操作
查看>>
axure学习点
查看>>
WPF文本框只允许输入数字[转]
查看>>
dom4j 通用解析器,解析成List<Map<String,Object>>
查看>>
第一个项目--用bootstrap实现美工设计的首页
查看>>
使用XML传递数据
查看>>
TYVJ.1864.[Poetize I]守卫者的挑战(概率DP)
查看>>
0925 韩顺平java视频
查看>>
iOS-程序启动原理和UIApplication
查看>>
mysql 8.0 zip包安装
查看>>
awk 统计
查看>>