Gym 101047M Removing coins in Kem Kadrãn Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Andréh and his friend Andréas are board-game aficionados. They know many of their friend…
给定一个序列,只能拿走D,隔壁的会翻转,问能否全部拿走. 注意到如果能拿走的话,拿D的顺序是没关系的.模拟即可 #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <algorithm> using namespace std; #define inf (0x3f3f3f3f) typedef long long int LL; #in…
Gym 100935F A Poet Computer Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Description standard input/output The ACM team is working on an AI project called (Eih Eye Three) that allows computers to write poems. One of th…
 Gym 101047K Training with Phuket's larvae Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output Thai cuisine is known for combining seasonings so that every dish has flavors that are…
Gym 101047E Escape from Ayutthaya Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Practice  Description standard input/output Ayutthaya was one of the first kingdoms in Thailand, spanning since its foundation in 1350 to…
 Gym 101047B  Renzo and the palindromic decoration Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Practice Description standard input/output At the ruins of Wat Phra Si Sanphet (วดพระศรสรรเพชญ), one can find famous inscr…
Weird Cryptography Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935B Description standard input/output Khaled was sitting in the garden under an apple tree, suddenly! , well... you should guess what happened, a…
Board Game Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935G Description standard input/outputStatements Feras bought to his nephew Saleem a new game to help him learning calculating. The game consists of a boa…
题目链接:https://codeforc.es/gym/101606/problem/F 题解: 假设 $f[i][j]$ 表示抛 $i$ 次硬币,有 $j$ 个硬币正面朝上的概率. 所以只有两种挑选硬币的情况: 1.正面硬币数量为 $[0,n-1]$,选择反面硬币抛,则正面硬币数量比原本增加 $1$ 或者不变. 2.正面硬币数量为 $n$,随便选择一个硬币抛,则正面硬币数量比原本减少 $1$ 或者不变. 因此可得状态转移方程: 对于 $j<n$,有 f[i+][j+]+=f[i][j]*][…
Problem Description People in Silverland use square coins. Not only they have square shapes but also their values are square numbers. Coins with values of all square numbers up to 289 (=17^2), i.e., 1-credit coins, 4-credit coins, 9-credit coins, ...…
https://vjudge.net/problem/Gym-100712G 题意:给出n枚不同价值的硬币和一个总价S,现在要选择尽量多的硬币来大于等于S,要求是比如说现在选择的硬币的总和为sum,那么所选择的任何一个硬币x,sum-x都必须<S. 思路: 一开始是想排序然后优先选择小的...没想到最后是暴力枚举. 因为N很小,最大也就是10,每枚要么选,要么不选,二进制枚举. #include<iostream> #include<algorithm> #include&l…
参考博客:http://www.cnblogs.com/kang000/p/8571071.html  (这篇博客写的真的走心,ORZ) 题意有n个硬币排成一排,开始的时候所有的硬币都是正面朝下,你必须要扔K次硬币,每次选择一个硬币,如果你采取最优策略,K次以后朝上的硬币数的最大期望是多少? 分析 一脸懵逼两脸懵逼三脸懵逼··· -------------------------------------------------------------------------- 随机变量X是指朝上…
Heavy Coins   Bahosain has a lot of coins in his pocket. These coins are really heavy, so he always tries to get rid of some of the coins by using them when paying for the  taxi. Whenever Bahosain has to pay S pennies for the taxi driver, he tries to…
题目链接:http://www.ifrog.cc/acm/problem/1143?contest=1020&no=0 题解:就是瞎暴力具体多暴力看一下代码就知道了. #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <cmath> using namespace std; typedef long long ll; ][]…
http://hihocoder.com/problemset/problem/1288 这题是这次微软笔试的第一题,关键的是s的上限是min(w, h),这样s的范围只有到1000,这样就可以直接暴力了,当然用二分也行,不过暴力写起来更快一点. 代码: #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #inc…
1065: Operations on Grids Time Limit: 3 Sec  Memory Limit: 128 MB Submit: 17  Solved: 4 [Submit][Status][Web Board] Description 你有一个  9  位数字串,现在你把这个数字的每一位填到  3 × 3  格子上.如果数 字是  123456789,那么填到  3 × 3  格子上会得到:  123 456 789 现在你可以对这  3 × 3  格子做四种操作: 现在给你…
Solved A Gym 100712A Who Is The Winner Solved B Gym 100712B Rock-Paper-Scissors Solved C Gym 100712C Street Lamps Solved D Gym 100712D Alternating Strings Solved E Gym 100712E Epic Professor Solved F Gym 100712F Travelling Salesman Solved G Gym 10071…
目录 A. Darker and Darker B. LRUD Game 题面 题解 代码 C. Removing Coins 题面 题解 代码 D. Complexity 题面 题解 代码 E. Go around a Circle F. Adding Edges 总结 题目有点神仙,被虐爆了. A. Darker and Darker \(Bfs\) 水题,没用,不写了. B. LRUD Game 题面 LRUD Game 有一个 \(n\times m\) 的棋盘,横纵坐标均从 \(1\)…
构造题都是神仙题 /kk ARC066C Addition and Subtraction Hard 首先要发现两个性质: 加号右边不会有括号:显然,有括号也可以被删去,答案不变. \(op_i\)和\(A_{i+1}\)之间只会有一个括号:有多个括号的话只保留最外边那个,答案不变. 然后就可以定义状态:\(dp_{i,j}\)表示前\(i\)个数,还有\(j\)个未闭合的左括号,得到的最大答案. 由于只有减号右边有括号,所以只要知道左边有几个未闭合的左括号,就可以知道自己的贡献是\(1\)还是…
鉴于Codeforces和atcoder上有很多神题,即使发呆了一整节数学课也是肝不出来,所以就记录一下. AGC033B LRUD Game 只要横坐标或者纵坐标超出范围就可以,所以我们只用看其中一维就可以了. 我们又知道,如果先手想要让它从左边出去,那么先手就会一直Left,后手就会一直Right. 所以枚举四种情况(L,R,U,D)就可以了. AGC033C Removing Coins 首先我们考虑链的情况,如果选的是端点,那么有一个点没有硬币,如果选的不是端点,那么有两个点没有硬币.所…
AGC033 A - Darker and Darker 直接BFS #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #define eps 1e-10 #define…
link:http://acm.hdu.edu.cn/showproblem.php?pid=4737 暴力可以过啊.O(N^2)的复杂度. #include <cstdio> ]; int main(void) { #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); #endif int t; scanf("%d", &t); long long int ans; ; i…
link:http://acm.hdu.edu.cn/showproblem.php?pid=4691 暴力,数据明显太水了吧,n=10^5, O(n^2)的复杂度哎喂.想让大家暴力写直接让n=1000不就得了么,这算什么. #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cctype…
不要62 题目大意:给你一个区间,算出该区间里不含62或4的数的个数 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2089 /* // 暴力就可以过了... #include<stdio.h> #define N 1000000 int sum[N]; bool fun(int x) { bool flag=0; while(x) { int tmp=x%10; if(tmp==4) return 0; else if(tmp==2) flag…
http://acm.hdu.edu.cn/showproblem.php?pid=4068 暴力枚举两个全排列,犯了若干错误,以此为鉴 #include <iostream> #include <cstdio> #include <cstring> #include <map> using namespace std ; ],vis[],vis2[],temp[] ; ],ans[],s[][],res[] ; int OK() { int i,j,fla…
链接:https://ac.nowcoder.com/acm/contest/318/G LLLYYY很喜欢写暴力模拟贪心思维.某一天在机房,他突然抛给了队友ppq一 个问题.问题如下: 有一个函数f (): int f(int x){     int tmp = 0;     while(x != 0){     tmp += x % 10;     x /= 10;     }     return tmp; } 接着LLLYYY给定一个整数 c,要求在c范围内找两个整数a和b,使得a +…
A - Coins Time Limit:3000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description standard input/output Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a…
A. Coins 题目链接:http://codeforces.com/gym/101102/problem/A time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Hasan and Bahosain want to buy a new video game, they want to share the expenses. H…
传送门 Description Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a set of M coins. The video game costs W JDs. Find the number of ways in which they can pay exactly W JDs su…
Hasan and Bahosain want to buy a new video game, they want to share the expenses. Hasan has a set of N coins and Bahosain has a set of M coins. The video game costs W JDs. Find the number of ways in which they can pay exactly W JDs such that the diff…