水题。。
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<algorithm>
#include<math.h>
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<l;i++)
if(a[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"<<endl;
else cout<<"Correct"<<endl;
}else
cout<<"Too weak"<<endl;
return 0;
}
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.
The first line contains three integers n, m, k (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.
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.
4 3 5 1 0 0 1 0 2 2 3 1 3 2 0
1 1 3 0
3 2 2 1 2 1 2 2 2
1 1 0
1 1 1 0
0
#include <cstdio>
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;
}
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.
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.
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).
1 100 100 1 99 99 99 99
Team 1
1 1 2 2 3 3 2 2
Team 2
3 3 2 2 1 1 2 2
Draw
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 <iostream>
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<algorithm>
#include<math.h>
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<a.a2+a.d1)
aa=a.a2,ad=a.d1;
else
{
if(abs(a.a1-a.d2)>abs(a.a2-a.d1))
aa=a.a1,ad=a.d2;
else aa=a.a2,ad=a.d1;
}
//cout<<aa<<' '<<ad<<endl;
if((b.a1>ad&&b.d2>aa)||(b.a2>ad&&b.d1>aa))
cout<<"Team 2"<<endl;
else if((b.a1<ad&&b.d2<aa)&&(b.a2<ad&&b.d1<aa))
cout<<"Team 1"<<endl;
else cout<<"Draw"<<endl;
return 0;
}