diff --git a/POJ/3299_小優YoU.cpp b/POJ/3299_小優YoU.cpp new file mode 100644 index 0000000..eab82f9 --- /dev/null +++ b/POJ/3299_小優YoU.cpp @@ -0,0 +1,38 @@ +//Memory Time +//240K 0MS + +#include +#include +#include +#include +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< +#include +#include +#include +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< +#include +#include +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 +//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; +} diff --git a/QUSTOJ/1371.cpp b/QUSTOJ/1371.cpp new file mode 100644 index 0000000..b9fbecf --- /dev/null +++ b/QUSTOJ/1371.cpp @@ -0,0 +1,25 @@ +#include +const int MAXN = 1024; +int p[MAXN]; +int main() +{ + int n; + scanf("%d",&n); + for(int i=0;i +#include +#include +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; +} diff --git a/QUSTOJ/1430.cpp b/QUSTOJ/1430.cpp new file mode 100644 index 0000000..6a38ec8 --- /dev/null +++ b/QUSTOJ/1430.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +int main() +{ + int a,b,c,d; + char tmp[256]; + int times; + scanf("%d",×); + 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='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; +}