sicily题目之1561 1566 1569 1634

1561. PRIME
 
 
Total: 6222Accepted:1457Rating:
2.5/5.0(30 votes)
 

   
 
Time Limit: 1s Memory Limit: 32MB
Description
A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself.
The first prime number is 2. Can you write a program that computes the nth prime number, given a number n <= 10000?
Input
The input contains just one number which is the number n as described above.
The maximum value of n is 10000.
Output
The output consists of a single line with an integer that is the nth prime number.
Sample Input
Copy sample input to clipboard
30
Sample Output
113
#include<stdio.h>
#include<math.h>
long int p(int n)
{
int r=0;
long int i,k;
for(i=2;r<n;i++)
{for(k=2;k<=floor(sqrt(i));k++)
if(i%k==0) break;
if(k==floor(sqrt(i)+1)) r++;
}
return i-1;
}
int main()
{
long int n;
scanf("%d",&n);
printf("%ld/n",p(n));
return 0;
}
 
         
         
1566. 4SUM[Special judge]
 
 
Total: 781Accepted:430Rating:
2.4/5.0(8 votes)
 
   
 
Time Limit: 1s Memory Limit: 32MB
Description
In this task, you are provided with four sets of integers. Your task consists of selecting one integer from each set,
such that their sum is 0.
You can assume that such selection exists.
Input
The first line of input contains four numbers, a, b, c, and d, separated by a space character, indicating the number of
elements in each of the four sets.
Each of these numbers is a positive integer 1 <= a, b, c, d <= 500.
The following a + b + c + d lines contain the elements, each not smaller than −10000 and not larger than 10000.
The elements of the first set are listed first,
followed by the elements of the second set, etc.
Output
The output consists of the four integers, separated by a space character. The numbers must appear in the order
in which they are listed in the input.
Sample Input
Copy sample input to clipboard
3 2 4 2
5
17
-8
-13
19
6
-9
10
0
-14
7
Sample Output
17 -13 10 -14
#include<stdio.h>
int main()
{
int a[4][500],b[4],i,j,sum=0,k,l;
for(i=0;i<4;i++)
scanf("%d",&b[i]);
for(j=0;j<4;j++)
for(i=0;i<b[j];i++)
scanf("%d",&a[j][i]);

for(i=0;i<b[0];i++)
for(j=0;j<b[1];j++)
for(k=0;k<b[2];k++)
for(l=0;l<b[3];l++)
if(a[0][i]+a[1][j]+a[2][k]+a[3][l]==0)
{printf("%d %d %d %d/n", a[0][i],a[1][j],a[2][k],a[3][l]);
return 0;}
return 0;

}
 
                  
                  
1569. Encrypted SMS
 
 
Total: 190Accepted:120Rating:
3.7/5.0(3 votes)
 
   
 
Time Limit: 1s Memory Limit: 32MB
Description
This year, ACM scientific committee members use emails to discuss about the problems and edit the selected ones.
They know that email is not a secure way of communication,
especially on such an important topic.
So they transfer password-protected compressed file among themselves.
In order to send the passwords, they use SMS. To increase the security level, the encrypted passwords are sent by SMS.
To do this, a multi-tap SMS typing method is used.

Multi-tap is currently the most common text input method for mobile phones. With this approach,
the user presses each key one or more times to obtain the wanted characters.
For example, the key 2 is pressed once to get character A, twice for B, and three times for C.

The encryption algorithm that is used is quite simple: to encrypt the ith character of the password,
the key used to obtain that character is tapped i more times. For if the 4th character of password is U,
the key 8 is tapped 6 times, getting the character V.
Note that to make the problem simple, we have assumed that the keypad does not generate digits.

The scientific committee needs a program to decrypt the received passwords.
They are too busy to write this program and have asked you to help!
Write a program to get a correct encrypted text and print the original password.
Input
The input consists of multiple test cases. Each test case contains a non-empty string of length at most 100,
consisting of small or capital English letters. The last line of the input contains a single #.
Output
For each test case, write the decrypted password in a separate line. Note that passwords are case-sensitive.
Sample Input
Copy sample input to clipboard
BACE
GgaudQNS
#
Sample Output
ABCD
IhateSMS
#include<stdio.h>
int main()
{
char key[8][4]={"abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
char in[101],co[101];
int i,j,k=0,l;


while(1)
{



scanf("%s",in);
if(in[0]=='#')
return 0;
for(i=0;in[i]!='/0';i++)
co[i]=in[i];
for(k=0;in[k]!='/0';k++)
for(i=0;i<8;i++)
for(j=0;key[i][j]!='/0'&&j<=3;j++)
{
if(in[k]<'a')
in[k]+=('a'-'A');

if(in[k]==key[i][j])
{ l=j;
if(i<=6&&j-k-1<0&&i!=5)
{while(l-k-1<0)
l+=3;
if(co[k]<'a')
printf("%c",key[i][l-k-1]-('a'-'A'));
else
printf("%c",key[i][l-k-1]);
break;
}
else if((i==7||i==5)&&j-k-1<0)
{
while(l-k-1<0)
l+=4;
if(co[k]<'a')
printf("%c",key[i][l-k-1]-('a'-'A'));
else
printf("%c",key[i][l-k-1]);
}
else
   { if(co[k]<'a')
printf("%c",key[i][l-k-1]-('a'-'A'));
else
printf("%c",key[i][l-k-1]);}

}
}printf("/n");
}


}
 
                           
                           
1634. Relax! It's just a game
 
 
Total: 817Accepted:328Rating:
2.3/5.0(3 votes)
 
   
 
Time Limit: 5s Memory Limit: 32MB
Description
You: What's the score? Did I miss much?

 

Me: It's 2-1 for elAhli and the second half just started. The first half was quite boring.

 

You: Who scored first? elAhli or ezZamalek?

 

Me: What difference does it make?

 

You: Big difference! I can predict the outcome of the match if I knew the order of which goals were

scored in the first half.

 

Me: What do you mean?

 

You: It's 2-1 for elAhli, right? One of three things could have happened:

elAhli scored two goals then ezZamalek scored;

Or, elAhli scored its first goal, then ezZamalek, then elAhli again; Or, ezZamalek scored first,

then elAhli scored its two goals.

 

Me: So?!! I still don't understand what difference does that make? It's still 2-1 for elAhli!

Why don't you just relax and let us continue watching the game in peace.

 

You: You don't understand!! I believe the probability of who'll win depends on the order of how goals were scored.

Now I have to predict the outcome for 3 possibilities.

 

Me: And what if the score was 3-2? What would you have done then?

 

You: I would have to work for 5 different possibilities. No?

 

Me: Of course not! The number of possibilities isn't always equal to the sum.

 

You: Can you tell me when will it be equal to the sum?

 

Me: You're a programmer, why don't you write a program that counts the number of possibilities and compare it to

the sum?

 

You: I don't have the time, I want to watch the match. Besides, I have nine other problems to worry about.

 

Me: I'll give you a hint. The possibilities will be equal to the sum only if one of the teams scored a certain number of

goals.

Input

Your program will be tested on one or more test cases. Each test case specifies two natural numbers (A and B )

(separated by one or more spaces) representing the score of the first half.

No team will be able to score more than 10 goals.

The last line of the input file contains two -1's

(which is not part of the test cases.)

Output

Format For each test case where the number of possibilities is equal to the sum, print:


A +B =C

 


Where A and B are as above and C is their sum. If the number of possibilities is not equal to the sum,

replace the `=' sign with `!=' (without the quotes.)

Sample Input
Copy sample input to clipboard
2 1
1 0
-1 -1
Sample Output
2+1=3
1+0=1
#include<stdio.h>
int mul(int a);
int main()
{
int a,b,sum,scal;
while(1)
{
scanf("%d %d",&a,&b);
if(a>10||b>10)
return 0;
if(a!=-1||b!=-1)
{sum=a+b;
scal=mul(sum)/mul(b)/mul(a);
if(scal==sum)
printf("%d+%d=%d/n",a,b,sum);
else
printf("%d+%d!=%d/n",a,b,sum);
}
else
return 0;
}
}
int mul(int a)
{
int i;
int sum=1;
for(i=1;i<=a;i++)
sum*=i;
return sum;
}
 
 
 
 

利用 TensorFlow 训练自己的目标识别器。本文内容来自于我的毕业设计,基于 TensorFlow 1.15.0,其他 TensorFlow 版本运行可能存在问题。.zip项目工程资源经过严格测试可直接运行成功且功能正常的情况才上传,可轻松复刻,拿到资料包后可轻松复现出一样的项目,本人系统开发经验充足(全领域),有任何使用问题欢迎随时与我联系,我会及时为您解惑,提供帮助。 【资源内容】:包含完整源码+工程文件+说明(如有)等。答辩评审平均分达到96分,放心下载使用!可轻松复现,设计报告也可借鉴此项目,该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的。 【提供帮助】:有任何使用问题欢迎随时与我联系,我会及时解答解惑,提供帮助 【附带帮助】:若还需要相关开发工具、学习资料等,我会提供帮助,提供资料,鼓励学习进步 【项目价值】:可用在相关项目设计中,皆可应用在项目、毕业设计、课程设计、期末/期中/大作业、工程实训、大创等学科竞赛比赛、初期项目立项、学习/练手等方面,可借鉴此优质项目实现复刻,设计报告也可借鉴此项目,也可基于此项目来扩展开发出更多功能 下载后请首先打开README文件(如有),项目工程可直接复现复刻,如果基础还行,也可在此程序基础上进行修改,以实现其它功能。供开源学习/技术交流/学习参考,勿用于商业用途。质量优质,放心下载使用。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值