题目链接: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. ios专题 - CocoaPods - 初次体验

    [原创]http://www.cnblogs.com/luoguoqiang1985 这CocoaPods怎么用呢? 参考官方文章:guides.cocoapods.org/using/using-c ...

  2. label语句和break continue的使用(高程第三章)

    break&&outermost var num = 0; outermost: for(var i=0;i<10;i++){ for(var j=0;j<10;j++){ ...

  3. gulp之css,js压缩合并加密替换

    为了防止客户端的静态资源缓存,我们需要每次更新css或js的时候,通过md5或时间戳等方式重新命名静态资源.让客户端可以重新请求资源,而不是从缓存里取.然后html模板里的src也要做相应的修改.当然 ...

  4. 读书笔记之 - javascript 设计模式 - 适配器模式

    适配器模式可以用来在现在接口和不兼容的类之间进行适配. 使用这种模式的对象又叫包装器,因为他们是在用一个新接口包装另一个对象. 在设计类的时候往往遇到有些接口不能与现有api一同使用的情况,借助于适配 ...

  5. 关于sqlserver2012重启后ID自增1000的问题解决方案

    1. Open "SQL Server Configuration Manager" 2. Click "SQL Server Services" on the ...

  6. cell的循环使用

    cell的循环利用:(对cell的简单优化) 1.创建一个标示(Identifier),用于区分缓存池里的不同cell. 2.去缓存池里拿自己对应的cell,用到dequeueReusableCell ...

  7. CSS3中的选择器

    首先, CSS即层叠样式表(Cascading StyleSheet) CSS3是CSS技术的升级版本,CSS3语言开发是朝着模块化发展的 模块包括: 盒子模型.列表模块.超链接方式 .语言模块 .背 ...

  8. struts.xml文件示范

    <?xml version="1.0" encoding="GBK"?> <!--下面指定Struts2配置文件的DTD信息--> &l ...

  9. 添加标签2 jquery 和JS

    TAG添加标签 做了个方法方便调用 一.JS版本 <!DOCTYPE html> <html lang="en"> <head> <met ...

  10. 使用css3画饼图

    CSS3 Gradient介绍参考地址: http://www.cnblogs.com/lhb25/archive/2013/01/30/css3-linear-gradient.html http: ...