码迷,mamicode.com
首页 > 其他好文 > 详细

2018 多校3 hdu 6319 6322 6324 6330

时间:2019-07-21 21:18:56      阅读:102      评论:0      收藏:0      [点我收藏+]

标签:队列   print   ++   eve   hid   scanf   none   规律   cout   

6319 a题

才看完单调队列(待补

 

6322 d题

一个数论题,找规律就出来了

技术图片
 1 #include <iostream>
 2 #include <cstring>
 3 #include <cstdio>
 4 
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     long long n,k;
10     cin>>n;
11     while(n--){
12         cin>>k;
13     if(k==1) cout<<5<<endl;
14     else cout<<5+k<<endl;
15     }
16 
17     return 0;
18 
19 }
View Code

 

6324 f题

异或然后判断等于1还是0

输出就可以了

技术图片
 1 #include <iostream>
 2 #include <cstdio>
 3 #include <cstring>
 4 #include <algorithm>
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int t,w,n,u,v;
10     scanf("%d",&t);
11     while(t--){
12         scanf("%d",&n);
13         int cnt = 0;
14         for(int i = 0; i<n; i++){
15             scanf("%d",&w);
16             cnt^=w;
17         }
18         for(int i =0;i<n-1;i++){
19             scanf("%d%d",&u,&v);
20         }
21         if(cnt == 0) printf("D\n");
22         else printf("Q\n");
23     }
24     return 0;
25  } 
View Code

 

 

6330 L题

一个模拟题,我写了好久(写了两遍),不知道大佬是怎么三分钟过掉的QAQ

技术图片
 1 #include<iostream>
 2 #include<cmath>
 3 #include<cstring>
 4 #include<cstdio>
 5 using namespace std;
 6 
 7 char s[100][100];
 8 const int maxn = 100;
 9 void put(int r,int l)
10 {
11     for(int i=1; i<=r; i++)
12     {
13         for(int j=1; j<=l; j++)
14             printf("%c",s[i][j]);
15         puts("");
16     }
17 }
18 int main()
19 {
20     int t;
21     scanf("%d",&t);
22     while(t--)
23     {
24         int a,b,c;
25         scanf("%d%d%d",&a,&b,&c); 
26         for(int i=1; i<100; i++)
27             for(int j=1; j<100; j++)
28                 s[i][j]=.;
29         int indexj = b*2+1;
30         for(int i=1; i<=b*2; i++)
31  {
32             if(i%2)
33             {
34                 for(int j=indexj; j<=indexj+2*a; j++)
35                 {
36                     if(j%2)s[i][j]=+;
37                     else s[i][j]=-;
38                 }
39             }
40             else
41             {
42                 for(int j=indexj; j<=indexj+2*a; j++)
43                 {
44                     if(j%2==0)s[i][j]=/;
45                     else s[i][j]=.;
46                 }
47             }
48             indexj--;
49 
50         }
51         for(int i=b*2+1; i<=b*2+1+c*2; i++)
52         {
53             if((i-b*2)%2)
54             {
55                 for(int j=1; j<=a*2+1; j++)
56                 {
57                     if(j%2)s[i][j]=+;
58                     else s[i][j]=-;
59                 }
60             }
61             else
62             {
63                 for(int j=1; j<=a*2+1; j++)
64                 {
65                     if(j%2)s[i][j]=|;
66                     else s[i][j]=.;
67                 }
68             }
69         }
70         int indexi=2*b+1;
71         for(int j=a*2+1; j<=a*2+b*2+1; j++)
72         {
73             if((j-a*2)%2)
74             {
75                 for(int i=indexi; i<=indexi+c*2; i++)
76                 {
77                     if((i-indexi)%2==0)
78                         s[i][j]=+;
79                     else s[i][j]=|;
80                 }
81             }
82             else
83             {
84                 for(int i=indexi; i<=indexi+c*2; i++)
85                 {
86                     if((i-indexi)%2==0)
87                         s[i][j]=/;
88                     else s[i][j]=.;
89                 }
90             }
91             indexi--;
92         }
93         int h = b*2+1+c*2;
94         int l = a*2+b*2+1;
95         put(h,l);
96     }
97     return 0;
98 }
View Code

 

2018 多校3 hdu 6319 6322 6324 6330

标签:队列   print   ++   eve   hid   scanf   none   规律   cout   

原文地址:https://www.cnblogs.com/moomight/p/11222732.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!