NCEPU第六次积分赛
来源:互联网 发布:深入浅出4g网络下载 编辑:程序博客网 时间:2024/05/26 19:18
D - D
Submit Status Practice ZOJ 1151
Description
For eachlist of words, output a line with each word reversed without changing the orderof the words.
This problem contains multiple test cases!
Thefirst line of a multiple input is an integer N, then a blank line followed by Ninput blocks. Each input block is in the format indicated in the problemdescription. There is a blank line between input blocks.
Theoutput format consists of N output blocks. There is a blank line between outputblocks.
Input
You willbe given a number of test cases. The first line contains a positive integerindicating the number of cases to follow. Each case is given on a linecontaining a list of words separated by one space, and each word contains onlyuppercase and lowercase letters.
Output
For eachtest case, print the output on one line.
Sample Input
1
3
I am happy today
To be or not to be
I want to win the practice contest
Sample Output
I mayppah yadot
oT eb ro ton ot eb
I tnaw ot niw eht ecitcarp tsetnoc
#include"stdio.h"int main(){ char s[1005]; int N,i,j,T,k; scanf("%d",&T); while(T--) { scanf("%d",&N); getchar(); while(N--) {gets(s);i=j=0;while(s[j]){if(s[j]==' '){for(k=j-1;k>=i;k--)printf("%c",s[k]);printf(" ");i=j+1;}j++;}for(k=j-1;k>=i;k--)printf("%c",s[k]);printf("\n"); } if(T) printf("\n"); }return 0;}
E - E
Time Limit:2000MS MemoryLimit:65536KB 64bit IO Format:%lld& %llu
Submit Status Practice ZOJ 2736
Description
Thedaffodil number is one of the famous interesting numbers in the mathematicalworld. A daffodil number is a three-digit number whose value is equal to thesum of cubes of each digit.
Forexample. 153 is a daffodil as 153 = 13 + 53 + 33.
Input
Thereare several test cases in the input, each case contains a three-digit number.
Output
One linefor each case. if the given number is a daffodil number, then output"Yes", otherwise "No".
Sample Input
153
610
Sample Output
Yes
No
#include"stdio.h"int main(){ int N,tn,sum,t; while(scanf("%d",&N)!=EOF) { t=N%10; tn=N/10; sum=t*t*t; t=tn%10; tn=tn/10; sum+=t*t*t; t=tn%10; tn=tn/10; sum+=t*t*t; printf("%s\n",sum==N? "Yes":"No"); }return 0;}
F - F
Time Limit:2000MS MemoryLimit:65536KB 64bit IO Format:%lld& %llu
Submit Status Practice ZOJ 2850
Description
Tom's Meadow
Tom hasa meadow in his garden. He divides it into N * M squares.Initially all the squares were covered with grass. He mowed down the grass onsome of the squares and thinks the meadow is beautiful if and only if
- Not all squares are covered with grass.
- No two mowed squares are adjacent.
Twosquares are adjacent if they share an edge. Here comes the problem: Is Tom'smeadow beautiful now?
Input
Theinput contains multiple test cases!
Eachtest case starts with a line containing two integers N, M (1<= N, M <= 10) separated by a space. Therefollows the description of Tom's Meadow. There're N lines eachconsisting of M integers separated by a space. 0(zero) meansthe corresponding position of the meadow is mowed and 1(one) means the squareis covered by grass.
A linewith N = 0 and M = 0 signals the end of theinput, which should not be processed
Output
One linefor each test case.
Output"Yes" (without quotations) if the meadow is beautiful, otherwise"No"(without quotations).
Sample Input
2 2
1 0
0 1
2 2
1 1
0 0
2 3
1 1 1
1 1 1
0 0
Sample Output
Yes
No
No
#include"stdio.h"int main(){ int N,M,i,j,f; while(scanf("%d%d",&N,&M)!=EOF&&(N+M)) {int a[12][12];for(i=0;i<12;i++){for(j=0;j<12;j++){a[i][j]=1;}}f=0;for(i=1;i<=N;i++){for(j=1;j<=M;j++){scanf("%d",&a[i][j]);f+=a[i][j];}}if(f==N*M)f=0;elsef=1;for(i=1;i<=N&&f;i++){ for(j=1;j<=M&&f;j++) { if(!a[i][j]) { if(a[i+1][j]+a[i][j+1]+a[i][j-1]+a[i-1][j]<4) f=0; } }}printf("%s\n",f? "Yes" : "No"); }return 0;}
G - G
TimeLimit:2000MS Memory Limit:65536KB 64bitIO Format:%lld & %llu
Submit Status Practice ZOJ 2723
Description
Prime NumberDefinition
An integer greater than one is called a prime number if its only positivedivisors (factors) are one and itself. For instance, 2, 11, 67, 89 are primenumbers but 8, 20, 27 are not.
Semi-Prime NumberDefinition
An integer greater than one is called a semi-prime number if it can bedecompounded to TWO prime numbers. For example, 6 is a semi-prime number but 12is not.
Your task is just todeterminate whether a given number is a semi-prime number.
Input
There are several testcases in the input. Each case contains a single integer N (2 <= N <=1,000,000)
Output
One line with a singleinteger for each case. If the number is a semi-prime number, then output"Yes", otherwise "No".
Sample Input
3
4
6
12
Sample Output
No
Yes
Yes
No
#include"stdio.h"int a[1000002];int main(){ int N; int i,j; for(i=2;i<=1000;i++) {if(!a[i]){for(j=i*i;j<1000002;j+=i){a[j]=i;}} } while(scanf("%d",&N)!=EOF) { if(a[N] && !a[N/a[N]]) printf("Yes\n"); else printf("No\n"); }return 0;}
H - H
Time Limit:2000MS MemoryLimit:65536KB 64bit IO Format:%lld& %llu
Submit Status Practice ZOJ 2829
Description
Mike isvery lucky, as he has two beautiful numbers, 3 and 5. But he is so greedy thathe wants infinite beautiful numbers. So he declares that any positive numberwhich is dividable by 3 or 5 is beautiful number. Given you an integer N (1<= N <= 100000), could you please tell mike the Nth beautiful number?
Input
Theinput consists of one or more test cases. For each test case, there is a singleline containing an integer N.
Output
For eachtest case in the input, output the result on a line by itself.
Sample Input
1
2
3
4
Sample Output
3
5
6
9
#include"stdio.h"int a[100002];int main(){ int N; int i,j=1; for(i=3;i<=214285;i++) {if(i%3==0||i%5==0){a[j++]=i;} } while(scanf("%d",&N)!=EOF) { printf("%d\n",a[N]); }return 0;}
- NCEPU第六次积分赛
- 积分赛第六次两个水题
- 第六次
- 第六届蓝桥杯【国赛试题1】积分之迷
- 第六次作业
- 第六次作业
- 第六次作业
- 第六次作业
- 第六次作业
- 第六次作业
- 第六次编程题
- 第六次c++实验
- 第六次作业
- 第六次作业
- 第六次作业
- 第六次课后作业
- 第六次课后作业
- 第六次课后作业
- WPF双击事件
- Ubuntu下面scroll lock无法使用的解决方法
- C语言简单校园导游程序的设计与实现
- SQL缓存依赖
- 数据挖掘-聚类分析:k-平均(k-Means)算法实现(C++)
- NCEPU第六次积分赛
- 直接拿来用!最火的Android开源项目(完结篇)
- Python学习(八)------- 控制结构和异常处理
- 嵌入式总结
- ubuntu挂载磁盘软件
- WPF鼠标事件简介
- Activity生命周期记忆方法
- XBMC研究之C-Pluff熟悉
- CSS长度单位:px和pt的区别