怎样做营销型网站推广,php网站如何做特效,郑州郑州网站建设河南做网站公司哪家好,dede门户网站模板题目链接 题意 #xff1a; 就是猜数游戏#xff0c;根据给定的操作#xff0c;让你输出一个符合条件的。 思路 #xff1a; 这个题好玩儿#xff0c;设置两个变量#xff0c;一个找符合条件的数的上限#xff0c;一个找下限#xff0c;再判断一下。 1 #include st…题目链接 题意 就是猜数游戏根据给定的操作让你输出一个符合条件的。 思路 这个题好玩儿设置两个变量一个找符合条件的数的上限一个找下限再判断一下。 1 #include stdio.h2 #include string.h3 #include iostream4 5 using namespace std ;6 7 char s[5] ;8 9 int judge()
10 {
11 if(strlen(s) 2)
12 {
13 if(s[0] )
14 return 4 ;
15 else return 3 ;
16 }
17 if(strlen(s) 1)
18 {
19 if(s[0] )
20 return 2 ;
21 else return 1 ;
22 }
23 return 0;
24 }
25
26 int main()
27 {
28 int n,x ;
29 char c ;
30 scanf(%d,n) ;
31 int ansx -999999,ansn 9999999;
32 while(n--)
33 {
34 memset(s,0,sizeof(s)) ;
35 scanf(%s %d %c,s,x,c) ;
36 int a judge() ;
37
38 if(a 1)
39 {
40 if(c Y)
41 ansx max(x1,ansx) ;
42 else ansn min(x,ansn) ;
43 }
44 if(a 2)
45 {
46 if(c Y)
47 ansn min(x-1,ansn) ;
48 else ansx max(x,ansx) ;
49 }
50 if(a 3)
51 {
52 if(c Y)
53 ansx max(ansx,x) ;
54 else ansn min(x-1,ansn) ;
55 }
56 if(a 4)
57 {
58 if(c Y)
59 ansn min(ansn,x) ;
60 else ansx max(ansx,x) ;
61 }
62 }
63 if(ansx ansn)
64 printf(Impossible\n) ;
65 else printf(%d\n,ansx) ;
66 return 0 ;
67 } View Code 转载于:https://www.cnblogs.com/luyingfeng/p/3662762.html