Merge pull request #9 from KiritoTRw/patch-2

Patch 2
This commit is contained in:
KiritoTRw 2016-05-23 22:09:04 +08:00
commit c19572dbaf
7 changed files with 256 additions and 0 deletions

38
POJ/3299_小優YoU.cpp Normal file
View File

@ -0,0 +1,38 @@
//Memory Time
//240K 0MS
#include<iostream>
#include<math.h>
#include<string>
#include<iomanip>
using namespace std;
int main(void)
{
char alpha;
double t,d,h;
int i;
for(;;)
{
t=d=h=200; //三个参数的范围默认都是在-100 ~ 100
for(i=0;i<2;i++)
{
cin>>alpha;
if(alpha=='E')
return 0;
else if(alpha=='T')
cin>>t;
else if(alpha=='D')
cin>>d;
else if(alpha=='H')
cin>>h;
}
if(h==200)
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
else if(t==200)
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
else if(d==200)
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
cout<<setprecision(1)<<fixed<<"T "<<t<<" D "<<d<<" H "<<h<<endl;
}
return 0;
}

38
QUSTOJ/1249.cpp Normal file
View File

@ -0,0 +1,38 @@
//Memory Time
//240K 0MS
#include<iostream>
#include<math.h>
#include<string>
#include<iomanip>
using namespace std;
int main(void)
{
char alpha;
double t,d,h;
int i;
for(;;)
{
t=d=h=200; //三个参数的范围默认都是在-100 ~ 100
for(i=0;i<2;i++)
{
cin>>alpha;
if(alpha=='E')
return 0;
else if(alpha=='T')
cin>>t;
else if(alpha=='D')
cin>>d;
else if(alpha=='H')
cin>>h;
}
if(h==200)
h=t+0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
else if(t==200)
t=h-0.5555*(6.11*exp(5417.7530*(1/273.16-1/(d+273.16)))-10);
else if(d==200)
d=1/((1/273.16)-((log((((h-t)/0.5555)+10.0)/6.11))/5417.7530))-273.16;
cout<<setprecision(1)<<fixed<<"T "<<t<<" D "<<d<<" H "<<h<<endl;
}
return 0;
}

59
QUSTOJ/1292.cpp Normal file
View File

@ -0,0 +1,59 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
void draw(int c)
{
for(int L=1;L<=c;L++)
{
for(int i=0;i<(c-L);i++)
{
printf(" ");
}
printf("/");
for(int i=0;i<2*L-2;i++)
{
printf(" ");
}
printf("\\");
for(int i=0;i<(c+(c-L)*2);i++)
{
printf(" ");
}
printf("/");
for(int i=0;i<2*L-2;i++)
{
printf(" ");
}
printf("\\");
printf("\n");
}
for(int i=0;i<c-1;i++)
{
printf("\n");
}
for(int i=0;i<2*c;i++)
{
printf(" ");
}
for(int i=0;i<c;i++)
{
printf("_");
}
printf("\n");
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n;
scanf("%d",&n);
draw(n);
printf("\n");
}
return 0;
}

34
QUSTOJ/1352.cpp Normal file
View File

@ -0,0 +1,34 @@
#include <cstdio>
//Written by Kiritow. 求最大公约数
long gcd(long a,long b)
{
if(a==0||b==0)
{
if(a+b==0)
{
return 0;
}
return (a==0)?b:a;
}
while(a!=b)
{
if(a>b)
{
a=a-b;
}
else
{
b=b-a;
}
}
return a;
}
int main()
{
int a,b;
scanf("%d%d",&a,&b);
long s=gcd(a,b);
printf("%ld %ld\n",s,a*b/s);
return 0;
}

25
QUSTOJ/1371.cpp Normal file
View File

@ -0,0 +1,25 @@
#include <cstdio>
const int MAXN = 1024;
int p[MAXN];
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
scanf("%d",&p[i]);
}
int m;
scanf("%d",&m);
m=m%n;
for(int i=n-m;i<n;i++)
{
printf("%d ",p[i]);
}
for(int i=0;i<n-m;i++)
{
printf("%d ",p[i]);
}
printf("\n");
return 0;
}

14
QUSTOJ/1373.cpp Normal file
View File

@ -0,0 +1,14 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
char buff[1024];
int main()
{
int n;
scanf("%d%*c",&n);
gets(buff);
scanf("%d",&n);
printf("%s\n",buff+n-1);
return 0;
}

48
QUSTOJ/1430.cpp Normal file
View File

@ -0,0 +1,48 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int a,b,c,d;
char tmp[256];
int times;
scanf("%d",&times);
for(;times>0;times--)
{
scanf("%s",tmp);
a=0;
b=0;
c=0;
d=0;
int len=strlen(tmp);
int i;
for(i=0;i<len;i++)
{
if(tmp[i]>='A'&&tmp[i]<='Z')
{
a=1;
}
else if(tmp[i]>='a'&&tmp[i]<='z')
{
b=1;
}
else if(tmp[i]>='0'&&tmp[i]<='9')
{
c=1;
}
else if(tmp[i]=='~'||tmp[i]=='!'||tmp[i]=='@'||tmp[i]=='#'||tmp[i]=='$'||tmp[i]=='%'||tmp[i]=='^')
{
d=1;
}
}
if(a+b+c+d>=3)
{
printf("YES\n");
}
else
{
printf("NO\n");
}
}
return 0;
}