Merge pull request #15 from KiritoTRw/master

Good codes.
This commit is contained in:
Kirigaya Kazuto 2016-05-22 11:22:38 -05:00
commit 82c412531b
9 changed files with 225 additions and 0 deletions

46
HDOJ/3527.cpp Normal file
View File

@ -0,0 +1,46 @@
#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int a, b, c;
string name;
while (cin >> a >> b >> c)
{
set<string> s;
vector<string> v;
for (int i=0; i<a; i++)
{
cin >> name;
s.insert(name);
}
for (int j=0; j<b; j++)
{
cin >> name;
if (s.count(name)) v.push_back(name);
}
for (int k=0; k<c; k++)
{
cin >> name;
for (int i=0; i<v.size(); i++)
{
if (v[i] == name)
{
v.erase(v.begin()+i);
}
}
}
if (v.empty()) cout << "No enemy spy\n";
else
{
int sz = v.size();
cout << v[0];
for (int i=1; i<sz; i++)
cout << " " << v[i];
cout << "\n";
}
}
return 0;
}

39
QUSTOJ/1282.cpp Normal file
View File

@ -0,0 +1,39 @@
#include <cstring>
#include <cstdio>
#include <cstdlib>
int c[26];
char buff[1024];
int main()
{
int n;
while(scanf("%d%*c",&n)==1)
{
gets(buff);
memset(c,0,sizeof(int)*26);
for(int i=0;i<n;i++)
{
if(buff[i]>='A'&&buff[i]<='Z')
{
++c[buff[i]-'A'];
}
else
{
++c[buff[i]-'a'];
}
}
bool flag=true;
for(int i=0;i<26;i++)
{
if(c[i]<1) flag=false;
}
if(!flag)
{
printf("NO\n");
}
else
{
printf("YES\n");
}
}
return 0;
}

21
QUSTOJ/1358.cpp Normal file
View File

@ -0,0 +1,21 @@
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
char buff[1024];
int main()
{
gets(buff);
int l=strlen(buff);
for(int i=0;i<l;i++)
{
if(buff[i]=='a'||buff[i]=='e'||buff[i]=='i'||buff[i]=='o'||buff[i]=='u')
{
printf("%c",buff[i]);
}
}
printf("\n");
return 0;
}

8
QUSTOJ/1359.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main()
{
int inc;
scanf("%d",&inc);
printf("%d %d %d %d \n",inc/1000,(inc%1000)/100,(inc%100)/10,inc%10);
return 0;
}

33
QUSTOJ/1360.cpp Normal file
View File

@ -0,0 +1,33 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int a,b,c,d;
char buff[2048];
int main()
{
gets(buff);
int L=strlen(buff);
for(int i=0;i<L;i++)
{
if((buff[i]>='a'&&buff[i]<='z')||(buff[i]>='A'&&buff[i]<='Z'))
{
a++;
}
else if(buff[i]>='0'&&buff[i]<='9')
{
b++;
}
else if(buff[i]==' ')
{
c++;
}
else
{
d++;
}
}
printf("%d %d %d %d \n",a,b,c,d);
return 0;
}

8
QUSTOJ/1362.c Normal file
View File

@ -0,0 +1,8 @@
#include <stdio.h>
int main()
{
int a,b;
scanf("%d %d",&a,&b);
printf("%d\n",a%b);
return 0;
}

11
QUSTOJ/1363.c Normal file
View File

@ -0,0 +1,11 @@
#include <stdio.h>
#include <math.h>
/*This program does not use #define to solve the problem*/
int main()
{
double a,b,c,p;
scanf("%lf %lf %lf",&a,&b,&c);
p=(a+b+c)/2;
printf("%.3lf\n",sqrt(p*(p-a)*(p-b)*(p-c)));
return 0;
}

37
QUSTOJ/1600.cpp Normal file
View File

@ -0,0 +1,37 @@
#include<bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0);
int a, b, c;
string name;
while (cin >> a >> b >> c) {
set<string> s;
vector<string> v;
for (int i=0; i<a; i++) {
cin >> name;
s.insert(name);
}
for (int j=0; j<b; j++) {
cin >> name;
if (s.count(name)) v.push_back(name);
}
for (int k=0; k<c; k++) {
cin >> name;
for (int i=0; i<v.size(); i++) {
if (v[i] == name) {
v.erase(v.begin()+i);
}
}
}
if (v.empty()) cout << "No enemy spy\n";
else {
int sz = v.size();
cout << v[0];
for (int i=1; i<sz; i++)
cout << " " << v[i];
cout << "\n";
}
}
return 0;
}

22
QUSTOJ/1631.c Normal file
View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char save[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;\'ZXCVBNM,./";
char maps[512];
char data[512];
int main()
{
for ( int i = 1 ; save[i] ; ++ i )
maps[save[i]] = save[i-1];
while ( gets(data) ) {
for ( int i = 0 ; data[i] ; ++ i )
if ( data[i] == ' ' || data[i] == ' ' )
printf("%c",data[i]);
else printf("%c",maps[data[i]]);
printf("\n");
}
return 0;
}