/*************************************************************************
File Name: 2026.cpp
Author: yubo
Mail: yuzibode@126.com
参考了别人的代码,主要还需要自己来写这些东西才行,
额,字符串的题目阿
reated Time: 2014年04月03日 星期四 04时17分21秒
************************************************************************/
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
char str[105],*p;
int i,n;
while(gets(str)){
n=strlen(str);
str[0]=str[0]-32;
for(i=1;i<n;i++){
if(str[i+1]!=' '&&str[i]==' ')
str[i+1]=str[i+1]-32;
}
str[n]='\0';
puts(str);
}
}
/*************************************************************************
File Name: 2031.cpp
Author: yubo
Mail: yuzibode@126.com
Created Time: 2014年04月05日 星期六 02时47分26秒
学习重点:重点是对非正数的使用上,自己又涨知识了:
************************************************************************/
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int n,i,j,R,a[1000];
while(scanf("%d%d",&n,&R)!=EOF){
if(n<0)
{
n=0-n;printf("-");
}
if(n==0)
printf("0\n");
i=0;
while(n>0){
a[i]=n%R;
n=n/R;
i++;
}
for(j=i-1;j>=0;j--){
if(a[j]==10) printf("A");
else if(a[j]==11) printf("B");
else if(a[j]==12) printf("C");
else if(a[j]==13) printf("D");
else if(a[j]==14) printf("E");
else if(a[j]==15) printf("F");
else printf("%d",a[j]);
}
printf("\n");
}
}
/*************************************************************************
File Name: 1290.cpp
Author: yubo
Mail: yuzibode@126.com
Created Time: 2014年04月06日 星期日 06时19分30秒
学习重点:自己的数学自己太少了,这是n条直线划分圆(最多)的问题,公式为:(n^3+5*n+6)/6:why?
************************************************************************/
#include<cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int sum(int n)
{
return (n*n*n+5*n+6)/6;
}
int main()
{
int a;
while(scanf("%d",&a)!=EOF)
{
printf("%d\n",sum(a));
}
}
hdu 模糊题
最新推荐文章于 2021-11-15 22:13:06 发布