Merge pull request #11 from KiritoTRw/master

Get Together for April Log.
This commit is contained in:
Kirigaya Kazuto 2016-05-01 23:05:49 +08:00
commit d6113b3599
7 changed files with 179 additions and 0 deletions

11
QUSTOJ/1023.java Normal file
View File

@ -0,0 +1,11 @@
import java.io.*;
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
BigInteger a=sc.nextBigInteger();
BigInteger b=sc.nextBigInteger();
System.out.println(a.multiply(b).divide(a.gcd(b)));
}
}

41
QUSTOJ/1144_***117.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <cstdio>
#include <cmath>
int prime[20010],f[20000];
void prime_2()
{
int n=20000,t=0;
for (int i=2;i<=n;i++)
{
if (!f[i])
{
prime[t++]=i;
int j=2*i;
while (j<=n)
{
f[j]=1;
j+=i;
}
}
}
}
int main ()
{
int n,x;
prime_2();
scanf("%d",&n);
int max=-1,m=0;
for (int i=0;i<n;i++)
{
scanf("%d",&x);
if (n==1) m=x;
else
for (int j=0;prime[j]<=x;j++)
if (x%prime[j]==0&&j>max)
{
max=j;
m=x;
}
}
printf("%d",m);
return 0;
}

17
QUSTOJ/1441.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <cstdio>
using namespace std;
const double pi=3.1415926;
double round;
int main()
{
while(scanf("%lf",&round)==1)
{
double ans=4*pi*round*round*round/3;
printf("%.3lf\n",ans);
}
return 0;
}

46
QUSTOJ/1445.cpp Normal file
View File

@ -0,0 +1,46 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int data[101][101];
bool vis[101][101];
int ans[101][101];
int d(int i,int j,int MaxDepth)
{
if(i==MaxDepth)
{
return data[i][j];
}
if(vis[i][j])
{
return ans[i][j];
}
int ret_a=d(i+1,j,MaxDepth);
int ret_b=d(i+1,j+1,MaxDepth);
int ret=(ret_a>ret_b)?(ret_a):(ret_b);
ret+=data[i][j];
ans[i][j]=ret;
vis[i][j]=true;
return ret;
}
int main()
{
int n;
scanf("%d",&n);
int t;
for(;n>0;n--)
{
scanf("%d",&t);
for(int i=1;i<=t;i++)
{
for(int j=1;j<=i;j++)
{
scanf("%d",&data[i][j]);
}
}
printf("%d\n",d(1,1,t));
memset(vis,false,sizeof(bool)*101*101);
}
return 0;
}

17
QUSTOJ/1448.cpp Normal file
View File

@ -0,0 +1,17 @@
#include <stdio.h>
int main()
{
int all,rep,i,ans;
scanf("%d",&all);
for(;all>0;all--)
{
scanf("%d",&rep);
ans=3;
for(i=0;i<rep;i++)
{
ans=(ans-1)*2;
}
printf("%d\n",ans);
}
return 0;
}

28
QUSTOJ/1449.cpp Normal file
View File

@ -0,0 +1,28 @@
#include <stdio.h>
int func(int n)
{
switch(n)
{
case 1:
return 0;
case 2:
return 1;
case 3:
return 2;
case 4:
return 9;
case 5:
return 44;
default:
return (n-1)*(func(n-1)*func(n-2));
}
}
int main()
{
int inc;
while(scanf("%d",&inc)==1)
{
printf("%d\n",func(inc));
}
return 0;
}

19
QUSTOJ/1619_****001.cpp Normal file
View File

@ -0,0 +1,19 @@
#include<stdio.h>
int main(){
int a;
scanf("%d",&a);
switch(a){
case 1:printf("Monday");break;
case 2:printf("Tuesday");break;
case 3:printf("Wednesday");break;
case 4:printf("Thursday");break;
case 5:printf("Friday");break;
case 6:printf("Saturday");break;
default:printf("Sunday");
}
return 0;
}