A水题 ~~  注意0输出

/*************************************************************************
> Author: xlc2845 > Mail: xlc2845@gmail.com
> Created Time: 2013年11月10日 星期日 19时35分23秒
************************************************************************/ #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cstdlib>
#define N 35
#define M 1000000007 using namespace std;
char a[15][10] =
{
"O-|-OOOO",
"O-|O-OOO",
"O-|OO-OO",
"O-|OOO-O",
"O-|OOOO-",
"-O|-OOOO",
"-O|O-OOO",
"-O|OO-OO",
"-O|OOO-O",
"-O|OOOO-"
};
int main()
{
int n;
scanf("%d",&n);
if(n == 0)
puts(a[0]);
while(n)
{
puts(a[n%10]);
n /= 10;
}
return 0;
}

B 用一个sum数组就可以了

/*************************************************************************
> Author: xlc2845 > Mail: xlc2845@gmail.com
> Created Time: 2013年11月10日 星期日 19时35分23秒
************************************************************************/ #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cstdlib>
#define N 150010
#define M 1000000007 using namespace std;
int high[N] = {};
int main()
{
int n, k, _min = M, _mini = 0;
scanf("%d%d", &n, &k);
for(int i = 1; i <= n; i++)
{
scanf("%d",&high[i]);
high[i] += high[i-1];
}
for(int i = 0; i+k <= n; i++)
{
int sum = high[k+i] - high[i];
if(sum < _min)
{
_min = sum;
_mini = i+1;
}
}
printf("%d\n", _mini);
return 0;
}

C 题 注意好细节

/*************************************************************************
> Author: xlc2845 > Mail: xlc2845@gmail.com
> Created Time: 2013年11月10日 星期日 19时35分23秒
************************************************************************/ #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <queue>
#include <stack>
#include <set>
#include <cstdlib>
#define N 250010
#define M 1000000007 using namespace std;
char str[N];
bool flag[N];
int main()
{
memset(flag, true, sizeof(flag));
int ok = 0;
bool ca = false;
char now;
gets(str);
int len = strlen(str);
for(int i = 0; i < len; i++)
{
if(!ok)
{
ok = 1;
now = str[i];
}
else if(ok == 1)
{
if(str[i] == now && !ca)
{
ok++;
ca = true;
}
else if(str[i] == now && ca)
{
flag[i] = false;
}
else
{
now = str[i];
ca = false;
}
}
else if(ok == 2)
{
if(str[i] == now)
flag[i] = false;
else
{
now = str[i];
ok = 1;
}
}
}
for(int i = 0; i < len; i++)
{
if(flag[i]) putchar(str[i]);
}
return 0;
}

cf 363A B C的更多相关文章

  1. ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'

    凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...

  2. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  3. cf Round 613

    A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...

  4. ARC下OC对象和CF对象之间的桥接(bridge)

    在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...

  5. [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现

    1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...

  6. CF memsql Start[c]UP 2.0 A

    CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...

  7. CF memsql Start[c]UP 2.0 B

    CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...

  8. CF #376 (Div. 2) C. dfs

    1.CF #376 (Div. 2)    C. Socks       dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...

  9. CF #375 (Div. 2) D. bfs

    1.CF #375 (Div. 2)  D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...

随机推荐

  1. 20141017--循环语句whlie,do

    int n = 0; ; ) {//n必须小于100,如果等于100则会再进来进行一次运算,变为101. //因为下面的语句中用到了continue,状态改变n++不能用到最后 n++; ) { m ...

  2. 使用JDBC从数据库中查询数据

    * ResultSet 结果集:封装了使用JDBC 进行查询的结果 * 1. 调用Statement 对象的 executeQuery(sql) 方法可以得到结果集 * 2. ResultSet 返回 ...

  3. ROS

    1 SSH 为什么我用 ssh 用户名 就不行,用 ssh xxx.xxx.xxx.xxx -l 用户名 就可以了呢 2 SCP 传送文件到另一个IP   用法: scp xxx  root@xx.x ...

  4. DWZ前端框架使用问题记录

    心得体验:DWZ依赖特定的HTML结构,所以一定要注意项目中的HTML结构,多用firebug查看,还有如果使用一些组件的时候出现问题,可以查看下返回JSON格式是否符合组件规定的JSON格式,很多都 ...

  5. Silverlight浮动窗体 floatablewindow 非模态对话框

    1.http://www.cnblogs.com/yinxiangpei/articles/2613913.html 说明:Silverlight的ChildWindow组件给我们的开发带来了便利,比 ...

  6. mongodb 入门笔记

    选择Mongo的关键是:这是一个 JSON 文档数据库. 1. Mongo 的术语 文档:一条完整的数据就是一个文档(对应于 MySQL 的一行). 集合:一组文档构成一个集合.类似 MySQL 中表 ...

  7. 安装ipvsadm时出现下面所示错误,MARK

    [root@localhost ipvsadm-1.26]# makemake -C libipvsmake[1]: Entering directory `/usr/local/soft/ipvsa ...

  8. SQLServer处理亿万级别的数据的优化措施

    如何在SQLServer中处理亿万级别的数据(历史数据),可以按以下方面进行: 去掉表的所有索引 用SqlBulkCopy进行插入 分表或者分区,减少每个表的数据总量 在某个表完全写完之后再建立索引 ...

  9. oracle中的存储过程例子

    用了两年Oracle还没写过存储过程,真是十分惭愧,从今天开始学习Oracle存储过程,完全零起点,争取每日一篇学习笔记,可能开始认识的不全面甚至有错误,但坚持下来一定会有收获. . 建立一个存储过程 ...

  10. json string 与object 之间的转化

    1.将json string转化成object 1: public static T GetObjectFromJson<T>(string jsonString) 2: { 3: Dat ...