8th省赛简单题
来源:互联网 发布:sql中求最大值最小值 编辑:程序博客网 时间:2024/05/20 21:44
21:52:47ZOJ3487.3492.3498.3499
A:
#include <stdio.h>//只要考虑到结尾是11 12 13的情况就可以了 其余的都是输出th的。。悲剧。
int main()
{
int a,n;
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
scanf("%d",&a);
if(a%10==1&&a%100!=11) printf("%dst/n",a);
else if (a%10==2&&a%100!=12) printf("%dnd/n",a);
else if (a%10==3&&a%100!=13) printf("%drd/n",a);
else printf("%dth/n",a);
}
}
return 0;
}
M:
#include<stdio.h>//!w顽疾排序了
int main()
{
int T,n,i;
double a[501],M,N,temp;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
if(n==1) {scanf("%lf",&a[0]);printf("%.3lf/n",a[0]);continue;}
for(i=0;i<n;i++) scanf("%lf",&a[i]);
for(i=0;i<n;i++)
for(int j=i+1;j<n;j++)//排序都出错,太丢人了。
if(a[i]>a[j]) {temp=a[i];a[i]=a[j];a[j]=temp;}
//for(i=0;i<n;i++)
// printf("%lf ",a[i]);检验排序出错否?y
if(n%2==0) //取中间两个
{
M=a[n/2];
N=a[n/2-1];
printf("%.3lf/n",(M+N)/2);
}
if(n%2!=0)//排序下,取中间一个
{
M=a[n/2];//数组元素是n/2而非n%2
printf("%.3lf/n",M);
}
}
return 0;
}
F:这道题目,意思有点难,可恶的英语。就是说你呢,站在n个人中间,其中给出一个人你知道他站在你前面,然后,你找出站在你后面人的名字。
#include <stdio.h>
#include <string.h>
int main()
{
int n,t,count,f,i,j;
char a[25],s[105][25];
while(scanf("%d",&n)!=EOF)
{
while(n--)
{
scanf("%d %s",&t,&a);
count=0;f=0;
for(i=0;i<t;++i)
{
scanf("%s",&s[i]);getchar();
}
for(i=0;i<t;++i)
{
if(strcmp(s[i],a)==0) j=i;
}
printf("%s/n",s[(j+t/2)%t]);//关键是目标名字位置的公式给出!!!
}
}
return 0;
}
L:不断缩短缩短缩短,代码都缩得这么短真是无语了
#include<stdio.h>
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
int n,day=1;
scanf("%d",&n);
while(n>1)
{
n/=2;
day++;
}
printf("%d/n",day);
}
return 0;
}
- 8th省赛简单题
- 12th.浙江省省赛A题 Ace of Aces
- 12th浙江省省赛 B题 Beauty of Array
- Light Bulb(浙江省省赛6th)
- 12th浙江省省赛 Team Formation
- 12th浙江省省赛 J Convert QWERTY to Dvorak(细节模拟题)
- Jan 8th, 2009
- Th
- th
- 省赛小结-7th Jilin Province Collegiate Programming Contest
- 12th浙江省省赛 H May Day Holiday
- 12th.浙江省省赛 G Lunch Time
- ZOJ-3488-Conic Section【8th浙江省赛】
- ZOJ-3490-String Successor【8th浙江省赛】【模拟】
- OpenGL 8th editon 4th chapter source code errdata
- 9th 浙江省赛总结
- 2008 December 8th Monday
- September 8th Tuesday 2009
- java面试题中的j2ee面试题(主要是Struts框架)
- 经典
- Struts2标签高级应用
- Windows 7 使用中的感叹
- group by rollup
- 8th省赛简单题
- 再次写给我们这些浮躁的程序员
- 网上复制文本在 Word 中空行的处理及部分字符
- 一道组合数问题
- 【转】计算机组成原理复习要点
- 链队列基本操作
- acrobat 9.3.2出现“抱歉出现中断,但是...”的解决方法
- vi命令
- connect by