t1//
1
#include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cstring> 5 #define ISA_XR 6 using namespace std; 7 int main() 8 { 9 #ifdef ISA_XR 10 freopen("200701.in","r",stdin); 11 freopen("200701.out","w",stdout); 12 #endif 13 14 int p[5],q[5],x,y = 20; 15 for(int i = 0;i <= 4;i++) cin>>p[i]; 16 q[0] = (p[0] + p[1]) + (p[2] + p[3] + p[4]) / 7; // 13 17 q[1] = p[0] + p[1] / ((p[2] + p[3]) / p[4]); // 8 18 q[2] = p[0] * p[1] / p[2]; // 7 19 q[3] = q[0] * q[1]; // 104 20 q[4] = q[1] + q[2] + q[3]; // 119 21 x = (q[0] + q[4] + 2) - p[(q[3] + 3) % 4]; // 129 22 if(x > 10) 23 y += (q[1] * 100 - q[3]) / (p[p[4] % 3] *5); // 43 24 else 25 y += 20 + (q[2] * 100 - q[3]) / (p[p[4] % 3] *5); 26 cout<<x<<","<<y<<endl; // 129,43 27 28 #ifdef ISA_XR 29 fclose(stdin); 30 fclose(stdout); 31 #endif 32 return 0; 33 } 34 //6 6 5 5 3
t2// 
1
#include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cstring> 5 //#define ISA_XR 6 using namespace std; 7 void fun(int *a,int *b) 8 { 9 int *k; 10 k = a; 11 a = b; 12 b = k; 13 } 14 int main() 15 { 16 #ifdef ISA_XR 17 freopen("200702.in","r",stdin); 18 freopen("200702.out","w",stdout); 19 #endif 20 21 int a = 3,b = 6, *x = &a, *y = &b; 22 fun(x,y); 23 cout<<"NO.1 : "<<a<<","<<b<<endl; 24 fun(&a,&b); 25 cout<<"No.2 : "<<a<<","<<b<<endl; 26 27 #ifdef ISA_XR 28 fclose(stdin); 29 fclose(stdout); 30 #endif 31 return 0; 32 }
t3// 
1
#include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 #include <cmath> 5 #include <iomanip> //setw() 6 //#define ISA_XR 7 using namespace std; 8 9 int main() 10 { 11 #ifdef ISA_XR 12 freopen("200703.in","r",stdin); 13 freopen("200703.out","w",stdout); 14 #endif 15 16 int a1[51] = {0}; 17 int i,j,t,t2,n = 50; 18 for(i = 2;i <= sqrt(n);i++) 19 if(a1[i] == 0) 20 { 21 t2 = n / i; 22 for(j = 2;j <= t2;j++) a1[i * j] = 1; 23 } 24 t = 0; 25 for(i = 2;i <= n;i++) 26 if(a1[i] == 0) 27 { 28 cout<<setw(4)<<i; // setw(int n)用来控制输出间隔(n-1)个 29 t++; 30 if(t % 10 == 0) cout<<endl; 31 } 32 cout<<endl; 33 // 2 3 5 7 11 13 17 19 23 29 34 //31 37 41 43 47 35 #ifdef ISA_XR 36 fclose(stdin); 37 fclose(stdout); 38 #endif 39 return 0; 40 }
t4// 
1
#include <iostream> 2 #include <cstdio> 3 #include <algorithm> 4 //#define ISA_XR 5 using namespace std; 6 char ch[] = {'q','A','S','O','R','T','E','X','A','M','P','L','E'}; 7 int n = 12; 8 9 void shift(int k,int n) 10 { 11 char v; 12 int j; 13 v = ch[k]; j = k + k; 14 while(j <= n) 15 { 16 if((j<n) && (ch[j]<ch[j+1])) j++; 17 if(v < ch[j]) 18 { 19 ch[j/2] = ch[j]; 20 j *= 2; 21 } 22 else return; 23 ch[j/2] = v; 24 } 25 } 26 27 void hpsrt(void) 28 { 29 int k; 30 char tmp; 31 for(k = n / 2;k > 0;k--) shift(k,n); 32 cout<<"No.1 : "; 33 for(k = 1;k <= n;k++) cout<<ch[k]; 34 cout<<endl; 35 for(k = n;k > 0;k--) 36 { 37 tmp = ch[1]; ch[1] = ch[k];ch[k] = tmp; 38 shift(1,k - 1); 39 } 40 } 41 int main() 42 { 43 #ifdef ISA_XR 44 freopen("200704.in","r",stdin); 45 freopen("200704.out","w",stdout); 46 #endif 47 48 int k; 49 hpsrt(); 50 cout<<"NO.2 : "; 51 for(k = 1;k <= n;k++) cout<<ch[k]; 52 cout<<endl; 53 54 /* 55 No.1 : XTORSEAAMPLE 56 No.2 : AAEELMOPRSTX 57 */ 58 #ifdef ISA_XR 59 fclose(stdin); 60 fclose(stdout); 61 #endif 62 return 0; 63 }