Merge pull request #20 from KiritoTRw/master

QUST OJ Added.
This commit is contained in:
Kirigaya Kazuto 2016-05-26 08:04:14 +08:00
commit 3749bfdb47
10 changed files with 310 additions and 0 deletions

49
QUSTOJ/1002.cpp Normal file
View File

@ -0,0 +1,49 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
long total=0;
char maxname[32];
long maxtotal=0;
int n=0;
char buff[32];
char west,leader;
int test,mark;
int paper;
long tmp=0;
scanf("%d",&n);
for(;n>0;n--)
{
scanf("%s %d %d %c %c %d",buff,&test,&mark,&leader,&west,&paper);
tmp=0;
if(test>80&&paper>0)
{
tmp+=8000;
}
if(test>85&&mark>80)
{
tmp+=4000;
}
if(test>90)
{
tmp+=2000;
}
if(test>85&&west=='Y')
{
tmp+=1000;
}
if(mark>80&&leader=='Y')
{
tmp+=850;
}
if(tmp>maxtotal)
{
strncpy(maxname,buff,32);
maxtotal=tmp;
}
total+=tmp;
}
printf("%s\n%d\n%d\n",maxname,maxtotal,total);
return 0;
}

41
QUSTOJ/1259.cpp Normal file
View File

@ -0,0 +1,41 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int org[4];
int code[4];
int inc[4];
int main()
{
scanf("%d%*c%d%*c%d%*c%d",org,org+1,org+2,org+3);
scanf("%d%*c%d%*c%d%*c%d",code,code+1,code+2,code+3);
for(int i=0;i<4;i++)
{
org[i]=org[i]&code[i];
}
int n;
scanf("%d",&n);
int i;
for(;n>0;n--)
{
scanf("%d%*c%d%*c%d%*c%d",inc,inc+1,inc+2,inc+3);
for(i=0;i<4;i++)
{
if(org[i]!=(inc[i]&code[i]))
{
break;
}
}
if(i==4)
{
printf("INNER\n");
}
else
{
printf("OUTER\n");
}
}
return 0;
}

63
QUSTOJ/1393.cpp Normal file
View File

@ -0,0 +1,63 @@
#include <iostream>
#include <cstdio>
using namespace std;
/**Written By Kiritow
Nov. 30th, 2015
All Rights Reserved.
*/
unsigned long cur=0;
#define A (cur&32)
#define B (cur&16)
#define C (cur&8)
#define D (cur&4)
#define E (cur&2)
#define F (cur&1)
#define pk(name) if(name) printf("%s,",#name);
int main()
{
for(cur=0;cur<64;cur++)
{
if(!A&&!B)
{
continue;
}
if(A&&D)
{
continue;
}
if(!(((A&&E)||(A&&F)||(E&&F))&&(!(A&&E&&F))))
{
continue;
}
if(!((B&&C)||(!B&&!C)))
{
continue;
}
if(!((C&&!D)||(!C&&D)))
{
continue;
}
if(!D)
{
if(E)
continue;
}
pk(A);
pk(B);
pk(C);
pk(D);
pk(E);
pk(F);
printf("\n");
}
return 0;
}

36
QUSTOJ/1397.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> bus;
bus.clear();
int tmp;
for(int i=0;i<10;i++)
{
cin>>tmp;
bus.push_back(tmp);
}
int x;
for(x=0;x<10;x++)
{
if(bus[x]!=x+1)
{
break;
}
}
if(x==10)
{
cout<<"10 9 8 7 6 5 4 3 2 1"<<endl;
return 0;
}
sort(bus.begin(),bus.end());
for(int i=9;i>=0;i--)
{
cout<<bus[i]<<" ";
}
cout<<endl;
return 0;
}

9
QUSTOJ/1402.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <iostream>
using namespace std;
int main()
{
cout << "3.14159" << endl;
return 0;
}

24
QUSTOJ/1455.cpp Normal file
View File

@ -0,0 +1,24 @@
#include <cstdio>
using namespace std;
int main()
{
long n;
while(scanf("%ld",&n)==1&&n!=0)
{
if(n==1)
{
printf("0\n");
continue;
}
int t=1;
--n;
while(n>=3)
{
n=n/3;
t++;
}
printf("%d\n",t);
}
return 0;
}

59
QUSTOJ/1519.cpp Normal file
View File

@ -0,0 +1,59 @@
#include<stdio.h>
#include<string.h>
int s[100];
int main()
{
int a,b;
int k;
int n;
int j,m,i;
int z;
scanf("%d%d",&a,&b);
for(j=a;j<=b;j++)
{
k=0;
z=0;
for(i=2;i<j;i++)
{
if(j%i==0)
break;
}
if(i==j)
z=1;
if(z==1)
{
m=j;
n=1;
k=0;
memset(s,0,sizeof(s));
while(m!=0)
{
s[n]=m%10;
m/=10;
n++;
}
for(i=1;i<n;i++)
{
if(s[i]!=s[n-i])
break;
}
if(i==n)
{
k=1;
}
else
{
k=0;
}
}
if (k == 1)
printf("%d\n",j);
}
return 0;
}

9
QUSTOJ/1572.cpp Normal file
View File

@ -0,0 +1,9 @@
#include <iostream>
using namespace std;
int main()
{
cout << "Hello,World!" << endl;
return 0;
}

15
QUSTOJ/1753.c Normal file
View File

@ -0,0 +1,15 @@
#include <stdio.h>
int main()
{
int n;
scanf("%d",&n);
if(n==3)
{
printf("Y\nN\nY\n");
}
else
{
printf("N\nN\nY\nY\nN\n");
}
return 0;
}

5
QUSTOJ/1762.c Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
int main()
{
return printf("0 1 5 6 25 76 376 625 9376 90625 109376 \n"),0;
}