英文原题 中文题译
大意:有五个纺车飞轮,每个都有最多五个缺口,飞轮转速恒定,有缺口对齐(飞梭可以跑)的最小时刻。
数据限制:全是整数,输出也是整数。
不用考虑真正的模拟,在小数时刻有缺口对齐的情况,只需考虑0-360秒下0-360度每个度是否是缺口。
这是我写的第二个版本。第一个版本试图模拟缺口,WA后发现描述中缺口可以大于180度,这样,一个缺口与另一个缺口的交可能是两个缺口,需考虑的情况过于复杂,想想,这肯定不是需要找的答案,就放弃先。唉。又一次。
PS:考虑一下不离散的情况,如何处理?
大意:有五个纺车飞轮,每个都有最多五个缺口,飞轮转速恒定,有缺口对齐(飞梭可以跑)的最小时刻。
数据限制:全是整数,输出也是整数。
不用考虑真正的模拟,在小数时刻有缺口对齐的情况,只需考虑0-360秒下0-360度每个度是否是缺口。
这是我写的第二个版本。第一个版本试图模拟缺口,WA后发现描述中缺口可以大于180度,这样,一个缺口与另一个缺口的交可能是两个缺口,需考虑的情况过于复杂,想想,这肯定不是需要找的答案,就放弃先。唉。又一次。
PS:考虑一下不离散的情况,如何处理?
/* ID: blackco3 TASK: spin LANG: C++ */ #include <iostream> #include <memory.h> using namespace std; const int _n_wheel_(5), _max_wedge_(5), _max_degree_(360) ; struct t_wheel { int speed, pos, is_wedge[_max_degree_] ; } wheels[_n_wheel_] ; bool all_wedge( int degree ) { for (t_wheel *pc=wheels; pc!=wheels+_n_wheel_; pc++ ) if ( !pc->is_wedge[ (_max_degree_ - pc->pos + degree)%_max_degree_ ] ) return false; return true; } int main() { freopen("spin.in", "r", stdin); freopen("spin.out", "w", stdout); memset( wheels, 0, sizeof(wheels) ); for( int i=0; i<_n_wheel_; i++ ){ int n_wedge, start, len ; cin >> wheels[i].speed >> n_wedge ; for( int j=0; j<n_wedge; j++ ){ cin >> start >> len ; for( int d=start; d<=start+len; d++ ) wheels[i].is_wedge[ d%_max_degree_ ] = 1 ; } } for( int t=0; t<_max_degree_; t++ ){ for (int i = 0; i <_max_degree_; i++) if ( all_wedge(i) ) { cout << t << endl ; return 0; } for (t_wheel *pc=wheels; pc!=wheels+_n_wheel_; pc++ ) pc->pos = (pc->pos+pc->speed) % _max_degree_ ; } cout << "none" << endl ; return 0; }
发表评论
-
USACO Training Section 4.2 Cowcycles
2010-01-31 21:11 882英文原题 中文题译 ... -
USACO Training Section 4.2 Job Processing
2010-01-30 17:31 1130英文原题 中文题译 大意: 有N个工件,每个工件要经 ... -
USACO Training Section 4.2 Drainage Ditches ISAP非递归和多路增广递归
2010-01-29 19:39 1843郁闷。不小心覆盖了重 ... -
USACO Training Section 4.2 The Perfect Stall 匈牙利算法的递归和非递归实现
2010-01-28 21:21 1641英文原题 中文题译 ... -
USACO Training Section 4.1 Cryptcowgraphy 奶牛密码
2010-01-27 20:58 1194英文原题 中文题译 大意: 奶牛们要从农场逃跑 ... -
USACO Training Section 4.1 Beef McNuggets
2010-01-26 21:37 964英文原题 中文题译 大意: 给定N个正整数, ... -
USACO Training Section 4.1 Fence Loops
2010-01-24 20:14 1061英文原题 大意: 农夫布朗的牧场上的篱笆已经失 ... -
USACO Training Section 3.4 Closed Fences
2010-01-23 17:50 1400英文原题 题意 一个 ... -
USACO Training Section 3.4 American Heritage
2010-01-21 23:19 771英文原题 大意:有一个由最多26个大写字母构成的二叉树 ... -
USACO Training Section 3.4 Raucous Rockers
2010-01-21 23:09 795英文原题 大意:有S首歌,要放到D个CD里。每首歌有一个 ... -
USACO Training Section 3.4 Electric Fence
2010-01-21 12:57 967英文原题 大意:给定一个三角形(0,0),(m,n),( ... -
USACO Training Section 3.3 Riding the Fences
2010-01-20 23:38 1203英文原题 中文题译 经典的求欧拉路径:给定最多两个奇 ... -
USACO Training Section 3.3 Shopping Offers
2010-01-19 22:18 912英文原题 中文题译 这是个与日常生活相关的题。商场促销 ... -
USACO Training Section 3.3 A Game
2010-01-19 20:54 1091英文原题 有如下一个双人游戏:N(2 <= N & ... -
USACO Training Section 3.3 Home on the Range
2010-01-19 19:36 771英文原题 中文题译 大意:给定一个01矩阵,计算其中全为 ... -
USACO Training Section 3.3 Camelot
2010-01-19 03:39 1228英文原题 中文题译 ... -
USACO Training Section 3.2 Sweet Butter
2010-01-19 00:10 1043英文原题 中文题译 大意:农场之间有路构成稀疏无向图,若 ... -
USACO Training Section 3.2 Magic Squares
2010-01-18 23:11 928英文原题 中文题译 大意:有人发明了一种有8个块三种变换 ... -
USACO Training Section 3.2 Feed Ratios
2010-01-18 20:52 1304英文原题 中文题译 大意:给出整数a[i][j]和 ... -
USACO Training Section 3.2 Stringsobits
2010-01-18 01:04 987英文原题 中文题译 大意:求至多有L个1的第i个N位二进 ...
相关推荐
ACM----USACO Training(解题博客网),提供了USACO Training解题的代码,可以参考一下
自己写的usaco_training带代码。供参考,有一道题是cheat的。自己看吧。
usaco测试数据+标程 usaco的section1到section5的所有测试数据 以及标准程序
usaco解题报告,就是usaco.training.gateway上面的题目全解
USACO题解+代码+翻译,好东西,超级齐全,对大家帮助不小,特别是现在nocow挂了
usaco section2.3--section5.5源程序。。。。。。。。。。。。。。。。
[USACO 1.1.4]破碎的项链.cpp
3.2 Section 3.2 3.3 Section 3.3 3.4 Section 3.4 4 Chapter4 4.1 Section 4.1 4.2 Section 4.2 4.3 Section 4.3 4.4 Section 4.4 5 Chapter5 5.1 Section 5.1 5.2 Section 5.2 5.3 Section 5.3 5.4 Section 5.4 ...
USACO全部译题 USACO Training Program Gateway
USACO_培训USACO_培训Ride.java-> Gift1.java->
因为 10=2*5,所以每有一个 0 就有一对 2*5=10 出现,反之,如果这个数的质因数分解没有成对的 2,5,我们就可以简单的对 10 求模,而不用管前面
USACO training 教程翻译合集(清晰明确)
USACO培训页面美国计算机奥林匹克训练页2015年6月17日开始
One of the answer of the USACO training exercises.
usaco 合集,包括英文原题和中文译题,测试数据以及答案,很全啊!usaco 合集usaco 合集usaco 合集usaco 合集
usaco历年测试数据
usaco 2010-2011 nov news,喜欢usaco的朋友可以看看
某些USACO题目的答案,很详细,代码清晰结构良好,算法高效易于调试
USACO题集及答案
usaco的总结和心得 包括了对题目的分了和总结 以及对题目的解法概括