直接枚举角度 数据比较水吧

 /*
ID: shangca2
LANG: C++
TASK: spin
*/
#include <iostream>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
using namespace std;
struct node
{
int l[],r[],k,v;
}p[];
int f[][];
int main()
{
freopen("spin.in","r",stdin);
freopen("spin.out","w",stdout);
int i,j,o,g;
for(i = ; i <= ; i++)
{
cin>>p[i].v;
cin>>p[i].k;
for(j = ; j <= p[i].k ; j++)
{
cin>>p[i].l[j]>>p[i].r[j];
if(p[i].l[j]+p[i].r[j]>=)
{
for(g = p[i].l[j]; g < ; g++)
f[i][g] = ;
for(g = ; g <= (p[i].l[j]+p[i].r[j])% ; g++)
f[i][g] = ;
}
else
for(g = p[i].l[j] ; g <= p[i].l[j]+p[i].r[j] ; g++)
f[i][g] = ;
}
}
o = ;
for(i = ; i < ; i++)
{
if(f[][i]&&f[][i]&&f[][i]&&f[][i]&&f[][i])
{
printf("0\n");
return ;
}
}
while()
{
o++;
memset(f,,sizeof(f));
for(i = ; i <= ; i++)
{
for(j = ; j <= p[i].k ; j++)
{
p[i].l[j] = (p[i].l[j]+p[i].v)%;
if(p[i].l[j]+p[i].r[j]>=)
{
for(g = p[i].l[j]; g < ; g++)
f[i][g] = ;
for(g = ; g <= (p[i].l[j]+p[i].r[j])% ; g++)
f[i][g] = ;
}
else
for(g = p[i].l[j] ; g <= p[i].l[j]+p[i].r[j] ; g++)
f[i][g] = ;
}
}
for(i = ; i < ; i++)
{
if(f[][i]&&f[][i]&&f[][i]&&f[][i]&&f[][i])
{
printf("%d\n",o);
return ;
}
}
if(o==)
{
puts("none");
return ;
}
}
return ;
}

USACO3.23Spinning Wheels的更多相关文章

  1. Java基础-继承-编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight。小车类Car是Vehicle的子类,其中包含的属性有载人数 loader。卡车类Truck是Car类的子类,其中包含的属性有载重量payload。每个 类都有构造方法和输出相关数据的方法。最后,写一个测试类来测试这些类的功 能。

    #29.编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight.小车类Car是Vehicle的子类,其中包含的属性有载人数 loader.卡车类T ...

  2. 洛谷P2728 纺车的轮子 Spinning Wheels

     P2728 纺车的轮子 Spinning Wheels 29通过 66提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交  讨论  题解 最新讨论 暂时没有讨论 题目背景 一架纺车 ...

  3. 编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight。小车类Car是Vehicle的子类,其中包含的属性有载人数 loader。卡车类Truck是Car类的子类,其中包含的属性有载重量payload。每个 类都有构造方法和输出相关数据的方法。最后,写一个测试类来测试这些类的功 能。

    package car; public class Vehicle { //定义成员变量 private int wheels; private double weight; public int g ...

  4. uva10067 Playing with Wheels 【建图+最短路】

    题目:option=com_onlinejudge&Itemid=8&page=show_problem&problem=1008">uva10067 Play ...

  5. 29.编写一个Java应用程序,设计一个汽车类Vehicle,包含的属性有车轮个数 wheels和车重weight。小车类Car是Vehicle的子类,其中包含的属性有载人数 loader。卡车类Truck是Car类的子类,其中包含的属性有载重量payload。每个 类都有构造方法和输出相关数据的方法。最后,写一个测试类来测试这些类的功 能。

    //Vehicle类 package d922A; public class Vehicle { private int wheels; private double weight; Vehicle( ...

  6. [uva] 10067 - Playing with Wheels

    10067 - Playing with Wheels 题目页:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Ite ...

  7. A Country on Wheels【车轮上的国家】

    A Country on Wheels As cultural symbols go, the American  car is quite young. 作为文化象征的美国汽车还相当年轻. The ...

  8. 洛谷 P2728 纺车的轮子 Spinning Wheels

    P2728 纺车的轮子 Spinning Wheels 题目背景 一架纺车有五个纺轮(也就是五个同心圆),这五个不透明的轮子边缘上都有一些缺口.这些缺口必须被迅速而准确地排列好.每个轮子都有一个起始标 ...

  9. USACO Spinning Wheels

    洛谷 P2728 纺车的轮子 Spinning Wheels https://www.luogu.org/problemnew/show/P2728 JDOJ 1800: Spinning Wheel ...

随机推荐

  1. C#上传图片和生成缩略图以及图片预览

    因工作需要,上传图片要增加MIME类型验证和生成较小尺寸的图片用于浏览.根据网上代码加以修改做出如下效果图: 前台代码如下: <html xmlns="http://www.w3.or ...

  2. leetcode之Rectangle Area

    Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined b ...

  3. (转)linux下mysql的安装过程

    最近在linux安装了mysql,根据网上收集的资料和个人的操作过程,大概做了个整理,以便以后进行参考回顾. 1.下载mysql-5.1.36.tar.gz,并且解压. tar -xzvf mysql ...

  4. HDU 4762 Cut the Cake

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋 ...

  5. js清空web用户控件的值

    假设你的用户控件里面有: <asp:DropDownList ID="DropDownList1" runat="server"> <asp: ...

  6. Delphi中的GetEnumName和GetEnumValue的使用方法

    利用TypInfo单元的GetEnumName和GetEnumValue可以遍历任意枚举类型,并获取其名称和值.下面是示例Demo. uses TypInfo; ... procedure TForm ...

  7. NetBeans8 类编缉器及控制台中文乱码解决

    1.类编辑器中文乱码的解决: 工具-->选项-->字体和颜色-->"语法"选项卡:右侧选择字体的地方设置一个支持中文的字体,如宋体.新宋体.微软雅黑等 2.控制台 ...

  8. office 问题集

    ----20131012---------------------------------------------------------------------------------------- ...

  9. spring IOC源码分析(3)

    1.IOC容器的依赖注入 Spring中,依赖注入是在用户第一次向IOC容器索要Bean时触发的(通过getBean方法). 在BeanFactory中我们看到getBean(String…)函数,它 ...

  10. POJ3613 Cow Relays [矩阵乘法 floyd类似]

    Cow Relays Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7335   Accepted: 2878 Descri ...