【Educational Codeforces Round 37 A】 Water The Garden
2018-02-03 10:14
441 查看
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
记录下水龙头在哪些位置。
然后每秒钟把index-i和index+i改变状态一下就好(置1
【代码】
#include <bits/stdc++.h> using namespace std; const int N = 200; int n,k; int a[N+10],x[N+10]; int ok(){ for (int i = 1;i <= n;i++) if (a[i]==0) return 0; return 1; } int main(){ #ifdef LOCAL_DEFINE freopen("rush_in.txt", "r", stdin); #endif ios::sync_with_stdio(0),cin.tie(0); int T; cin >> T; while (T--){ memset(a,0,sizeof a); cin >> n >> k; for (int i = 1;i <= k;i++){ cin >> x[i]; } int num = 0; while (!ok()){ for (int i = 1;i <= k;i++){ a[max(1,x[i]-num)]=1; a[min(n,x[i]+num)]=1; } num++; } cout<<num<<endl; } return 0; }
相关文章推荐
- Educational Codeforces Round 37 E. Connected Components?(bfs+思路)
- Educational Codeforces Round 37
- CF# Educational Codeforces Round 3 B. The Best Gift
- 【Educational Codeforces Round 3 B】【水题 基本容斥】The Best Gift n本书任选两个不能同一类型的方案数
- Educational Codeforces Round 22 C. The Tag Game
- 【Educational Codeforces Round 37 B】 Tea Queue
- Educational Codeforces Round 37
- Educational Codeforces Round 37-G.List Of Integers题解
- Educational Codeforces Round 4 A. The Text Splitting
- Educational Codeforces Round 1(D. Igor In the Museum) (BFS+离线访问)
- Educational Codeforces Round 13 B. The Same Calendar 水题
- Educational Codeforces Round 9 C - The Smallest String Concatenation ,学习到string
- Educational Codeforces Round 22-B. The Golden Age-暴力枚举+map
- 【Educational Codeforces Round 37 C】 Swap Adjacent Elements
- Educational Codeforces Round 37 (Rated for Div. 2) 920E E. Connected Components?
- Educational Codeforces Round 37 (Rated for Div. 2)F. SUM and REPLACE
- Educational Codeforces Round 1 D. Igor In the Museum
- 【Educational Codeforces Round 48 (Rated for Div. 2) D】Vasya And The Matrix
- 【Educational Codeforces Round 48 (Rated for Div. 2) C】 Vasya And The Mushrooms
- Educational Codeforces Round 9 C. The Smallest String Concatenation 排序