## 15分的题：

### 1026 程序运行时间

b = ( i n t ) ( ( d o u b l e ) b / 100.0 + 0.5 ) b=(int)((double)b/100.0+0.5)

### 1051 复数乘法

double x,y;
double tmp=cos(y1)*cos(y2)-sin(y1)*sin(y2);
double tmp1=cos(y1)*sin(y2)+sin(y1)*cos(y2);
tmp1*=x1*x2;
tmp*=x1*x2;
if(fabs(tmp)<0.005) tmp=0;
if(fabs(tmp1)<0.005) tmp1=0;
if(tmp1<0){

printf("%.2f%.2fi\n",tmp,tmp1);
}
else printf("%.2f+%.2fi\n",tmp,tmp1);


## 20分的题：

### 1003 我要通过！

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){

int n;
cin>>n;
for(int i=0;i<n;i++){

string a;
cin>>a;
int m=a.size(),f=1,fp=0,fa=0,ft=0;
for(int j=0;j<m;j++){

if(a[j]!='P'&&a[j]!='A'&&a[j]!='T'){

f=0;
break;
}
if(a[j]=='P') fp++;
else if(a[j]=='A') fa++;
else if(a[j]=='T') ft++;
}
if(!f||!fp||!fa||!ft||fp>1||ft>1) {

puts("NO");
continue;
}
char c='A';
int s1=0,s2=0,s3=0,f1=0,f2=0;
for(int j=0;j<m;j++){

if(!f1&&a[j]==c){

s1++;
}
else if(a[j]=='P'){

f1=1;
}
else if(!f2&&a[j]==c){

s2++;
}
else if(a[j]=='T'){

f2=1;
}
else if(f1&&f2&&a[j]=='A'){

s3++;
}
}
if((s2==1&&s1==s3)||(s3>=s1&&s1*s2==s3)) puts("YES");
else puts("NO");
}
return 0;
}


### 1014 福尔摩斯的约会

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e6+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
string We[7]={
"MON","TUE","WED","THU","FRI","SAT","SUN"};
bool check(char c){

return (c>='a'&&c<='z')||(c>='A'&&c<='Z');
}
bool fun(char c){

return c>='A'&&c<='G';
}
bool fun1(char c){

return c>='A'&&c<='N'||isdigit(c);
}
int main(){

string a,b,c,d;
cin>>a>>b>>c>>d;
int la=a.size(),lb=b.size(),da=-1,h=-1,m=-1;
for(int i=0;i<min(la,lb);i++){

if(da==-1&&a[i]==b[i]&&fun(a[i])){

da=a[i]-'A'+1;
}
else if(h==-1&&da!=-1&&a[i]==b[i]&&fun1(a[i])){

if(isdigit(a[i])) h=a[i]-'0';
else h=a[i]-'A'+10;
}
}
int lc=c.size(),ld=d.size();
for(int i=0;i<min(lc,ld);i++){

if(c[i]==d[i]&&check(c[i])){

m=i;
break;
}
}
cout<<We[da-1]<<" ";
printf("%02d:%02d\n",h,m);
return 0;
}


### 1017 A除以B

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int c[N];
int main(){

string a;
int b;
cin>>a>>b;
int n=a.size(),p=0;
for(int i=1;i<=n;i++) c[i]=a[i-1]-'0';
for(int i=1;i<=n;i++){

p=p*10+c[i];
c[i]=p/b;
p%=b;
}
int cnt=n,id=1;
while(!c[id]&&id<n) id++;
for(int i=id;i<=n;i++) cout<<c[i];
cout<<" "<<p;
return 0;
}


### 1018 锤子剪刀布

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int n,a,b,c,x,y,z,mx1[3],mx2[3],ch1,ch2;
PII p[3];
bool cmp(PII a,PII b){

return a.fi==b.fi?a.se<b.se:a.fi>b.fi;
}
char fun(int *a){

p[0]={
a[0],'C'},p[1]={
a[1],'J'},p[2]={
a[2],'B'};
sort(p,p+3,cmp);
return p[0].se;
}
int main(){

cin>>n;
while(n--){

char ch1,ch2;
cin>>ch1>>ch2;
if(ch1==ch2) b++,y++;
else if(ch1=='C'&&ch2=='J') a++,z++,mx1[0]++;
else if(ch1=='J'&&ch2=='B') a++,z++,mx1[1]++;
else if(ch1=='B'&&ch2=='C') a++,z++,mx1[2]++;
else {

if(ch2=='C') mx2[0]++;
else if(ch2=='J') mx2[1]++;
else if(ch2=='B') mx2[2]++;
c++,x++;
}
}
printf("%d %d %d\n%d %d %d\n",a,b,c,x,y,z);
printf("%c %c\n",fun(mx1),fun(mx2));
return 0;
}


### 1019 数字黑洞

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){

string n;
cin>>n;
int f=1,tmp;
for(int i=0;i<4;i++) if(n[i]!=n[3]) f=0;
if(f) cout<<n<<" - "<<n<<" = "<<"0000"<<endl;
else {

do{

string a=n,b;
sort(a.begin(),a.end());
b=a;
reverse(a.begin(),a.end());
while(a.size()<4) a=a+'0';
int c=stoi(a),d=stoi(b);
tmp=c-d;
printf("%04d - %04d = %04d\n",c,d,tmp);
n=to_string(tmp);
}while(tmp!=6174);
}
return 0;
}


### 1024 科学计数法

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e3+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int f1,z,f2;
string x;
string zhi;
int main(){

string a;
cin>>a;
int n=a.size();
f1=(a[0]=='+');
z=a[1]-'0';
int pos=0;
if(a.find('e')!=a.npos) pos=a.find('e');
if(a.find('E')!=a.npos) pos=a.find('E');
x=a.substr(3,pos-3);
f2=(a[pos+1]=='+');
zhi=a.substr(pos+2);
if(f2){

int p2=0;
while(zhi[p2]=='0') p2++;
int Z=stoi(zhi.substr(p2));
if(!f1) cout<<"-";
string tmp;
tmp+=a[1];
int p1=3,c=0;
for(int i=0;i<Z;i++,c++){

if(i<x.size()) tmp+=x[i];
else tmp+="0";
}
int p3=0;
while(tmp[p3]=='0') p3++;
for(int i=p3;i<tmp.size();i++) cout<<tmp[i];
if(c<x.size()) cout<<".";
for(int i=c;i<x.size();i++ )cout<<x[i];
}
else {

int p2=0;
while(zhi[p2]=='0') p2++;
int Z=stoi(zhi.substr(p2));
if(!f1) cout<<"-";
cout<<"0.";
for(int i=1;i<Z;i++){

cout<<"0";
}
cout<<z;
cout<<x;
}
return 0;
}


### 1029 旧键盘

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
int main(){

string a,b;
cin>>a>>b;
int s=0;
int la=a.size(),lb=b.size();
string ans;
int pos=0;
for(int i=0;i<la;i++){

char c=a[i];
if(b.find(c)==b.npos){

c=toupper(c);
if(ans.find(c)==ans.npos)
ans+=c,s++;
}
}
cout<<ans<<endl;
return 0;
}


### 1034 有理数四则运算

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=1e5+5,M=2e4+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a,b) memset(a,b,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first
#define se second
#define pb push_back
#define il inline
ll a,b,c,d;
ll gcd(ll a,ll b){

return !b?a:gcd(b,a%b);
}
void fun(ll a,ll b){

if(a%b==0){

if(a<0)
printf("(%lld)",a/b);
else printf("%lld",a/b);
}
else {

if(a>0){

if((a/b)) printf("%lld ",a/b);
printf("%lld/%lld",a%b,b);
}
else {

if(abs(a)/b){

printf("(-%lld ",abs(a)/b);
printf("%lld/%lld)",abs(a)%b,b);
}
else {

printf("(-%d/%d)",abs(a)%b,b);
}
}
}
}
int main(){

scanf("%lld/%lld %lld/%lld",&a,&b,&c,&d);
ll g1=__gcd(abs(a),b),g2=__gcd(abs(c),d);
a/=g1,b/=g1,c/=g2,d/=g2;
//printf("%d %d %d %d\n",a,b,c,d);
ll x1=a*d+b*c,y1=b*d;
g1=gcd(abs(x1),y1);
x1/=g1,y1/=g1;
fun(a,b),printf(" + "),fun(c,d),printf(" = ");
fun(x1,y1);
printf("\n");
///
fun(a,b),printf(" - "),fun(c,d),printf(" = ");
x1=a*d-b*c,y1=b*d;
g1=gcd(abs(x1),y1);
x1/=g1,y1/=g1;
fun(x1,y1);
printf("\n");
/
fun(a,b),printf(" * "),fun(c,d),printf(" = ");
x1=a*c,y1=b*d;
g1=gcd(abs(x1),y1);
x1/=g1,y1/=g1;
fun(x1,y1);
printf("\n");
fun(a,b),printf(" / "),fun(c,d),printf(" = ");
if(!c) puts("Inf");
else {

x1=a*d,y1=b*c;
g1=gcd(abs(x1),abs(y1));
x1/=g1,y1/=g1;
if(y1<0) y1=-y1,x1=-x1;

fun(x1,y1);
printf("\n");
}
return 0;
}


2020.9.15   d a y 3 ： 2020.9.15\ day3：