A:热手题
1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <algorithm> 5 #include <string> 6 #include <cstring> 7 #include <cmath> 8 #include <map> 9 #include <stack> 10 #include <set> 11 #include <vector> 12 #include <queue> 13 #include <time.h> 14 #define eps 1e-7 15 #define INF 0x3f3f3f3f 16 #define MOD 1000000007 17 #define rep0(j,n) for(int j=0;j<n;++j) 18 #define rep1(j,n) for(int j=1;j<=n;++j) 19 #define pb push_back 20 #define set0(n) memset(n,0,sizeof(n)) 21 #define ll long long 22 #define ull unsigned long long 23 #define iter(i,v) for(edge *i=head[v];i;i=i->nxt) 24 #define max(a,b) (a>b?a:b) 25 #define min(a,b) (a<b?a:b) 26 #define print_runtime printf("Running time:%.3lfs ",double(clock())/1000.0) 27 #define TO(j) printf(#j": %d ",j); 28 //#define OJ 29 using namespace std; 30 const int MAXINT = 100010; 31 const int MAXNODE = 100010; 32 const int MAXEDGE = 2*MAXNODE; 33 char BUF,*buf; 34 int read(){ 35 char c=getchar();int f=1,x=0; 36 while(!isdigit(c)){if(c=='-') f=-1;c=getchar();} 37 while(isdigit(c)){x=x*10+c-'0';c=getchar();} 38 return f*x; 39 } 40 char get_ch(){ 41 char c=getchar(); 42 while(!isalpha(c)) c=getchar(); 43 return c; 44 } 45 //------------------- Head Files ----------------------// 46 47 int a,b,c,n,t,ans; 48 void get_input(); 49 void work(); 50 int main() { 51 get_input(); 52 work(); 53 return 0; 54 } 55 void work(){ 56 printf("%d ",ans); 57 } 58 void get_input(){ 59 a=read();b=read();c=read(); 60 n=read(); 61 rep0(i,n){ 62 t=read(); 63 if(t>b&&t<c) ans++; 64 } 65 }
B:初中数学
1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <algorithm> 5 #include <string> 6 #include <cstring> 7 #include <cmath> 8 #include <map> 9 #include <stack> 10 #include <set> 11 #include <vector> 12 #include <queue> 13 #include <time.h> 14 #define eps 1e-7 15 #define INF 0x3f3f3f3f 16 #define MOD 1000000007 17 #define rep0(j,n) for(int j=0;j<n;++j) 18 #define rep1(j,n) for(int j=1;j<=n;++j) 19 #define pb push_back 20 #define set0(n) memset(n,0,sizeof(n)) 21 #define ll long long 22 #define ull unsigned long long 23 #define iter(i,v) for(edge *i=head[v];i;i=i->nxt) 24 #define max(a,b) (a>b?a:b) 25 #define min(a,b) (a<b?a:b) 26 #define print_runtime printf("Running time:%.3lfs ",double(clock())/1000.0) 27 #define TO(j) printf(#j": %d ",j); 28 //#define OJ 29 using namespace std; 30 const int MAXINT = 100010; 31 const int MAXNODE = 100010; 32 const int MAXEDGE = 2*MAXNODE; 33 char BUF,*buf; 34 int read(){ 35 char c=getchar();int f=1,x=0; 36 while(!isdigit(c)){if(c=='-') f=-1;c=getchar();} 37 while(isdigit(c)){x=x*10+c-'0';c=getchar();} 38 return f*x; 39 } 40 char get_ch(){ 41 char c=getchar(); 42 while(!isalpha(c)) c=getchar(); 43 return c; 44 } 45 //------------------- Head Files ----------------------// 46 47 int n,h; 48 void get_input(); 49 void work(); 50 int main() { 51 get_input(); 52 work(); 53 return 0; 54 } 55 void work(){ 56 double s=0.5*h,ans = s/n; 57 for(int i=1;i<n;i++){ 58 printf("%.12lf ",h*sqrt(i*ans/s)); 59 } 60 } 61 void get_input(){ 62 n=read();h=read(); 63 }
C:我讨厌游戏题
首先双方都只会选对他来说最优的那些字母来放置
为了方便,我们把希望字典序大的一方称为A,另一方为B
当A的最大字符比B的最小字符要大的时候,双方都会把对自己最优往前放
而当A的最大字符比B的最小字符要小的时候,双方会尽量把对自己不优的字符往后放,逼迫对方把不优的字符往前放
1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <algorithm> 5 #include <string> 6 #include <cstring> 7 #include <cmath> 8 #include <map> 9 #include <stack> 10 #include <set> 11 #include <vector> 12 #include <queue> 13 #include <time.h> 14 #define eps 1e-7 15 #define INF 0x3f3f3f3f 16 #define MOD 1000000007 17 #define rep0(j,n) for(int j=0;j<n;++j) 18 #define rep1(j,n) for(int j=1;j<=n;++j) 19 #define pb push_back 20 #define set0(n) memset(n,0,sizeof(n)) 21 #define ll long long 22 #define ull unsigned long long 23 #define iter(i,v) for(edge *i=head[v];i;i=i->nxt) 24 #define max(a,b) (a>b?a:b) 25 #define min(a,b) (a<b?a:b) 26 #define print_runtime printf("Running time:%.3lfs ",double(clock())/1000.0) 27 #define TO(j) printf(#j": %d ",j); 28 //#define OJ 29 using namespace std; 30 const int MAXINT = 300010; 31 const int MAXNODE = 100010; 32 const int MAXEDGE = 2*MAXNODE; 33 char BUF,*buf; 34 int read(){ 35 char c=getchar();int f=1,x=0; 36 while(!isdigit(c)){if(c=='-') f=-1;c=getchar();} 37 while(isdigit(c)){x=x*10+c-'0';c=getchar();} 38 return f*x; 39 } 40 char get_ch(){ 41 char c=getchar(); 42 while(!isalpha(c)) c=getchar(); 43 return c; 44 } 45 //------------------- Head Files ----------------------// 46 47 char s[2][MAXINT],ans[MAXINT]; 48 int cnt[2][26],p1,p2,c1,c2,l; 49 void get_input(); 50 void work(); 51 int main() { 52 get_input(); 53 work(); 54 return 0; 55 } 56 void work(){ 57 p1=0;p2=0; 58 rep0(i,l){ 59 if(s[1][p2]<=s[0][p1]){ 60 for(int j=l-1;j>=i;j--){ 61 if(((l-1-j)^i)&1){ 62 ans[j]=s[1][--c2]; 63 }else{ 64 ans[j]=s[0][--c1]; 65 } 66 } 67 break; 68 } 69 if(i&1){//big 70 ans[i]=s[1][p2++]; 71 }else{ 72 ans[i]=s[0][p1++]; 73 } 74 } 75 ans[l]='