题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1507

解题思路:这是一道模拟题,看了那么多人的代码,我觉得我的代码是最简的,哈哈,其实就是分数变幻的时候要计算灯管的亮数复杂一点,我就直接暴力咯

AC代码:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
const int M=;
int c[]={,,,,,,,,,};
char a[],b[];
struct node
{
int x,y,z;
}t[M];
int main()
{
int ca=;
while()
{
int i=-,g=,h=,x1,y1,z1;
long long sum=;
while(scanf("%s",a)!=EOF)
{
scanf("%d:%d:%d",&x1,&y1,&z1);
i++;
t[i].x=x1;t[i].y=y1;t[i].z=z1;
int ans=(t[i].x-t[i-].x)*+(t[i].y-t[i-].y)*+t[i].z-t[i-].z;
if(strcmp(a,"START")==) continue;
if(h>){sum+=ans*(c[h/]+c[h/%]+c[h%]);}
else if(h>) {sum+=ans*(c[h/]+c[h%]);}
else sum+=ans*(c[h%]);
if(g>){sum+=ans*(c[g/]+c[g/%]+c[g%]);}
else if(g>) {sum+=ans*(c[g/]+c[g%]);}
else {sum+=ans*(c[g%]);}
if(strcmp(a,"END")==) break;
int x2;
scanf("%s%d",b,&x2);
if(strcmp(b,"home")) h+=x2;
else if(strcmp(b,"guest")) g+=x2;
}
if(i==-) break;
printf("Case %d: %lld\n",ca++,sum);
}
return ;
}

改善代码:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
const int M=;
int c[]={,,,,,,,,,};
char a[],b[];
long long sum;
struct node
{
int x,y,z;
}t[M];
int work(int x)
{
if(x==) return c[];
int s=;
while(x)
{
s+=c[x%];
x/=;
}
return s;
}
int main()
{
int ca=;
while()
{
int i=-,g=,h=,x1,y1,z1;
sum=;
while(scanf("%s",a)!=EOF)
{
scanf("%d:%d:%d",&x1,&y1,&z1);
i++;
t[i].x=x1;t[i].y=y1;t[i].z=z1;
int ans=(t[i].x-t[i-].x)*+(t[i].y-t[i-].y)*+t[i].z-t[i-].z;
if(strcmp(a,"START")==) continue;
sum+=ans*(work(h)+work(g));
if(strcmp(a,"END")==) break;
int x2;
scanf("%s%d",b,&x2);
if(strcmp(b,"home")) h+=x2;
else if(strcmp(b,"guest")) g+=x2;
}
if(i==-) break;
printf("Case %d: %lld\n",ca++,sum);
}
return ;
}

CSU 1507 超大型LED显示屏 第十届湖南省赛题的更多相关文章

  1. CSU 1511 残缺的棋盘 第十届湖南省赛题

    题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1511 题目大意:在一个8*8的棋盘中,给你一个起点位置和一个终点位置,同时也给你一个陷阱 ...

  2. csuoj 1507: 超大型LED显示屏

    http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1507 1507: 超大型LED显示屏 时间限制: 1 Sec  内存限制: 128 MB 提交:  ...

  3. 超大型 LED 显示屏

    http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11574&courseid=0 题目 E. 超大型 L ...

  4. 河南省第十届省赛 Plumbing the depth of lake (模拟)

    title: Plumbing the depth of lake 河南省第十届省赛 题目描述: There is a mysterious lake in the north of Tibet. A ...

  5. 河南省第十届省赛 Intelligent Parking Building

    title: Intelligent Parking Building 河南省第十届省赛 tags: [模拟,省赛] 题目描述: There is a new revolution in the pa ...

  6. 四川第十届省赛 A.Angel Beats bitset

    四川第十届省赛 A.Angel Beats bitset 题目链接 题解参考:http://www.cnblogs.com/Aragaki/p/9142250.html 考虑用bitset来维护对于所 ...

  7. 福州大学第十届校赛 & fzu 2128最长子串

    思路: 对于每个子串,求出 母串中 所有该子串 的 开始和结束位置,保存在 mark数组中,求完所有子串后,对mark数组按 结束位置排序,然后 用后一个的结束位置 减去 前一个的 开始 位置 再 减 ...

  8. 【河南第十届省赛-D】年终奖金

    题目描述 ***公司承接了N个项目需要年底完成,每个项目有一定的难度系数.由于项目太多了,需要招聘大量的技术人员.要求每个技术人员至少完成K个项目. 考虑到有些项目之间相似性以及项目的难易程度,为了避 ...

  9. 【河南第十届省赛-B】情报传递

    题目描述 抗日战争时期,在国共合作的大背景下,中共不断发展壮大,其情报工作也开始由获取警报性.保卫性信息,向获取军政战略性情报转变.各系统情报组织遵循"荫蔽精干,长期埋伏,积蓄力量,以待时机 ...

随机推荐

  1. [Session] SessionHelper2---C#关于Session高级操作帮助类 (转载)

    点击下载 SessionHelper2.rar 这个类是关于Session的一些高级操作1.添加时限制时间2.读取对象3.读取数据等等看下面代码吧 /// <summary> /// 联系 ...

  2. 再次回首 TCP Socket服务器编程

    转载:http://www.cnblogs.com/zc22/archive/2010/06/27/1766007.html ------------------ 前言 --------------- ...

  3. AngularJS code converage

    karma-coverage The easiest way is to keep karma-coverage as a devDependency in your package.json. Mo ...

  4. 额定能量不得超过160Wh, 等同是多少mAh电池容量?

    额定能量不得超过160Wh, 等同是多少mAh电池容量?行动电源容量标示, 正确应该是用Whr(Wh)瓦特小时来标示, 不过坊间标榜行动电源的容量通常是用xx000mAhWHr瓦特小时, 即是行动电源 ...

  5. 修改PYTHONPATH的一种方法(在Window平台和Ubuntu下都有效)

    1.显示PYTHONPATH 2.修改PYTHONPATH 通过PYTHONPATH 中的任何 .pth 文件来添加pythonpath.比如我想添加/home/aa这个路径到pythonpath里, ...

  6. libConfuse的使用

    前言 在软件编程中经常会使用到一些参数,在存储方面一般有使用XML的,也有使用文本文件的,或者使用数据库的等.我们软件平台一些参数是使用XML文件存储,在读取方面的速度还可以,但在写回文件速度一般.也 ...

  7. nullptr和NULL 区别

    注:本文内容摘自网络,准确性有待验证,现阶段仅供学习参考.尊重作品作者成果,原文链接 :http://www.2cto.com/kf/201302/190008.html 1.为什要有nullptr ...

  8. MFC error C2065: “IDD_DIALOG1” : 未声明的标识符 转载

    error C2065: “IDD_DIALOG1” : 未声明的标识符 1.编译时提示error C2065: “IDD_DIALOG1” : 未声明的标识符 2.错误的可能原因及解决方法如下: 原 ...

  9. Windows phone常用控件之Button

    Button类:表示一个响应 ButtonBase.Click 事件的 Windows 按钮控件. 继承层次结构: 命名空间:    System.Windows.Controls ClickMode ...

  10. WPF 自定义路由事件

    如何:创建自定义路由事件 首先自定义事件支持事件路由,需要使用 RegisterRoutedEvent 方法注册 RoutedEvent C#语法 public static RoutedEvent ...