TOJ 2703: Cow Digit Game】的更多相关文章

2703: Cow Digit Game Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KByte Total Submit: 1            Accepted:1 Description Bessie is playing a number game against Farmer John, and she wants you to help her achieve victory. Game i start…
描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victory. Game i starts with an integer N_i (1 <= N_i <= 1,000,000). Bessie goes first, and then the two players alternate turns. On each turn, a player can…
3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 47  Solved: 32[Submit][Status] Description     贝茜和约翰在玩一个数字游戏.贝茜需要你帮助她.     游戏一共进行了G(1≤G≤100)场.第i场游戏开始于一个正整数Ni(l≤Ni≤1,000,000).游 戏规则是这样的:双方轮流操作,将当前的数字减去一个数,这个数可以…
3404: [Usaco2009 Open]Cow Digit Game又见数字游戏 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 72  Solved: 48[Submit][Status][Discuss] Description     贝茜和约翰在玩一个数字游戏.贝茜需要你帮助她.     游戏一共进行了G(1≤G≤100)场.第i场游戏开始于一个正整数Ni(l≤Ni≤1,000,000).游 戏规则是这样的:双方轮流操作,将当前的数字减去…
洛谷 2953 [USACO09OPEN]牛的数字游戏Cow Digit Game 题目描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victory. Game i starts with an integer N_i (1 <= N_i <= 1,000,000). Bessie goes first, and then the two players…
Description Farmer John's N (1 ≤ N ≤ 10,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level in the range 1...100,000. Since grumpy cows are more likely to damage FJ's milking equipment, FJ would like to r…
题目描述 Bessie is playing a number game against Farmer John, and she wants you to help her achieve victory. Game i starts with an integer N_i (1 <= N_i <= 1,000,000). Bessie goes first, and then the two players alternate turns. On each turn, a player c…
博弈论 Orz ZYF 从前往后递推……反正最大才10^6,完全可以暴力预处理每个数的状态是必胜还是必败(反正才两个后继状态),然后O(1)查询……我是SB /************************************************************** Problem: 3404 User: Tunix Language: C++ Result: Accepted Time:880 ms Memory:5180 kb ***********************…
一开始被题意坑了= =,题目是说这个数字的最大和最小,不是个位的最大和最小= = 不知道怎么做只能递推了,必胜态就是存在能到达必败态的,必败态就是只能到达必胜态的 CODE: #include<cstdio>#include<iostream>#include<algorithm>#include<cstring>using namespace std;#define MAX 1000000bool b[MAX+2];int solve(){ for (in…
http://www.lydsy.com/JudgeOnline/problem.php?id=3404 写挫好几次.... 裸的博弈论即可.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorithm> #include <queue> using name…
#include<cstring> #include<cstdio> #include<algorithm> #include<set> using namespace std; int m,n; int SG[1000001]; int sg(int x) { if(SG[x]!=-1) return SG[x]; if(!x) return SG[x]=0; set<int>S; int maxv=0,minv=2147483647; int…
1~9显然,后面平\(A\)过去 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> #define R(a,b,c) for(register int a = (b); a <= (c); ++a) #define nR(a,b,c) for(register int a = (b); a >=…
前些日子我打算开了博弈基础,事后想进行总结下 一句话就是分析必胜或必败,异或为0. 以下内容来自转载: Nim游戏的概述: 还记得这个游戏吗?给出n列珍珠,两人轮流取珍珠,每次在某一列中取至少1颗珍珠,但不能在两列中取.最后拿光珍珠的人输.后来,在一份资料上看到,这种游戏称为“拈(Nim)”.据说,它源自中国,经由被贩卖到美洲的奴工们外传.辛苦的工人们,在工作闲暇之余,用石头玩游戏以排遣寂寞.后来流传到高级人士,则用便士(Pennies),在酒吧柜台上玩.最有名的玩法,是把十二枚便士放成3.4.…
题目链接:http://acm.tju.edu.cn/toj/showp2502.html2502.   Digit Generator Time Limit: 1.0 Seconds   Memory Limit: 65536K Total Runs: 2426   Accepted Runs: 1579 For a positive integer N, the digit-sum of N is defined as the sum of N itself and its digits.…
Search GO 说明:输入题号直接进入相应题目,如需搜索含数字的题目,请在关键词前加单引号 Problem ID Title Source AC Submit Y 1000 A+B Problem 10983 18765 Y 1036 [ZJOI2008]树的统计Count 5293 13132 Y 1588 [HNOI2002]营业额统计 5056 13607 1001 [BeiJing2006]狼抓兔子 4526 18386 Y 2002 [Hnoi2010]Bounce 弹飞绵羊 43…
最近刷银组刷得好欢快,好像都是水题,在这里吧他们都记录一下吧(都是水题大家一定是道道都虐的把= =)几道比较神奇的题到时再列出来单独讲一下吧= =(其实我会说是BZOJ蹦了无聊再来写的么 = =) [Usaco2004 Dec]Bad Cowtractors牛的报复  很明显是最大生成树了吧,跟最小生成树一样做就行了 = =(排序时按从大到小的顺序排) [Usaco2004 Dec]Cleaning Shifts安排值班  贪心,按开始时间从小到大排,然后对于已经安排的时间,取在此时间开始的最晚…
bzoj上的usaco题目还是很好的(我被虐的很惨. 有必要总结整理一下. 1592: [Usaco2008 Feb]Making the Grade 路面修整 一开始没有想到离散化.然后离散化之后就很好做了.F[I,j]表示第i个点,高度>=j或<=j,f[I,j]=min(f[i-1,j]+abs(b[j]-a[i]),f[I,j-1]) 1593: [Usaco2008 Feb]Hotel 旅馆 线段树 ★1594: [Usaco2008 Jan]猜数游戏 二分答案然后写线段树维护 15…
1570: Cow Brainiacs  Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KByteTotal Submit: 15            Accepted:8 Description One afternoon as the cows were chewing their cud, Bessie said, "Let's have a contest to see who is the smartest…
The Cow Lineup Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5367   Accepted: 3196 Description Farmer John's N cows (1 <= N <= 100,000) are lined up in a row.Each cow is labeled with a number in the range 1...K (1 <= K <=10,000)…
Description Farmer John's N cows (1 <= N <= 100,000) are lined up in a row.Each cow is labeled with a number in the range 1...K (1 <= K <=10,000) identifying her breed. For example, a line of 14 cows might have these breeds: 1 5 3 2 5 1 3 4 4…
描述 A palindrome is a number that reads the same whether you read it from left to right or from right to left. Here is a surprising fact. Suppose we start with a number n. We reverse the digits of n and add it to n. If this number is a palindrome we s…
前队名太过晦气,故启用最大牛 我们的组队大概就是18年初,组队阵容是17级生詹志龙.陶源和16级的黄睿博. 三人大学前均无接触过此类竞赛,队伍十分年轻.我可能是我们队最菜的,我只是知道的内容最多,靠我躺赢的比赛基本没有(其实好几场我力揽狂澜的hhhh). 本博客有我的训练记录,他们的可以去这里 陶源(图论选手+数据结构) 詹志龙(DP+各种思维) 刚开始主要是一些水题,省赛前进行了比较多的组队训练 训练场次(TOJ的训练就不一一枚举了,个人感觉没太大提升) 浙南联合训练赛20180318 htt…
Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ... Note: n is positive and will fit within the range of a 32-bit signed integer (n < 231). Example 1: Input: 3 Output: 3 Example 2: Input: 11 Output: 0 Explanatio…
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example: Given n = 13, Return 6, because digit 1 occurred in the following numbers: 1, 10, 11, 12, 13. Hint: Beware of overflow.…
传送门 Catch That Cow Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 80273   Accepted: 25290 Description Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 10…
Given an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n. For example:Given n = 13,Return 6, because digit 1 occurred in the following numbers: 1, 10, 11, 12, 13. Hint: Beware of overflow. 大…
SB贪心,一开始还想着用二分,看了眼黄学长的blog,发现自己SB了... 最小道路=已选取的奶牛/道路总数. #include <iostream> #include <cstdio> #include <algorithm> using namespace std; ]; int n,m,d,l,ans; int main() { scanf("%d%d%d%d",&n,&m,&d,&l); ;i<=n;i+…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2838 Cow Sorting Problem Description Sherlock's N (1 ≤ N ≤ 100,000) cows are lined up to be milked in the evening. Each cow has a unique "grumpiness" level in the range 1...100,000. Since grumpy cow…
C. Digit Tree time limit per test:3 seconds memory limit per test:256 megabytes input:standard input output:standard output ZS the Coder has a large tree. It can be represented as an undirected connected graph of n vertices numbered from 0 to n - 1 a…
[BZOJ1604][Usaco2008 Open]Cow Neighborhoods 奶牛的邻居 试题描述 了解奶牛们的人都知道,奶牛喜欢成群结队.观察约翰的N(1≤N≤100000)只奶牛,你会发现她们已经结成了几个"群".每只奶牛在吃草的时候有一个独一无二的位置坐标Xi,Yi(l≤Xi,Yi≤[1..10^9]:Xi,Yi∈整数.当满足下列两个条件之一,两只奶牛i和j是属于同一个群的:   1.两只奶牛的曼哈顿距离不超过C(1≤C≤10^9),即lXi - xil+IYi - Y…