cf 363A B C
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的更多相关文章
- 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 ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- 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 ...
- 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 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
随机推荐
- VC中调用COM组件的方法(转载)
原文参考:http://hi.baidu.com/mingyueye/item/53ebecd44da76917d80e4449 总结一下在VC中调用COM组件的方法 准备及条件: COM服务器为进程 ...
- GPRS组网的几种方案【来自网络】
GPRS组网的几种方案:1) 方案一:中心采用ADSL等INTELNET公网连接,采用公网固定IP或者公网动态IP+DNS解析服务.此种方案向先INTERNET运营商申请ADSL等宽带业务. ...
- (转)在Windows上以服务方式运行 MSOPenTech/Redis
ServiceStack.Redis 使用教程里提到Redis最好还是部署到Linux下去,Windows只是用来做开发环境,现在这个命题发生改变了,在Windows上也可以部署生产环境的Redis, ...
- 判断Featureclass的类型
一个Featureclass可以是Shapefile Feature Class.Personal Geodatabase Feature Class.File Geodatabase Feature ...
- Win8 URI 方案 ms-appX 用法大全
ms-appdata://可以引用来自应用的本地.漫游和临时数据文件夹中的应用文件ms-appdata:///local/hello/logo.png ms-appx://可以引用来自应用包的应用文件 ...
- 【风马一族_git_github】gitGui与github的SSH
权限校验 首先,您的数据保存在远端服务器一份,服务器需要对您的身份识别.一段RSA加密字符串. 启动GUI,菜单-帮助,[Step1-创建密钥]Generate SSH KEY 步骤一: 步骤二: 步 ...
- ADO.NET笔记——将DataReader作为函数返回值
相关知识: 在很多情况下,可能把数据库的访问封装到一个函数中,通过该函数返回一个DataReader对象给调用者.例如定义函数:SqlDataReader returnDR(),然后再Main函数中调 ...
- sql中更新数据库用到declare @a in
declare @a in update TB_Class set @a=1,name='李小龙' where ID=1 这样就可以像更新哪个就更新哪个了 例如ibatisnet中需要更新的时候: & ...
- 如何使用NET Reactor为您的.Net(C#,VB.Net) 源代码加密
前言 VS开发的源代码安全性,是很多开发者头痛的事情.于是保护好源代码便成了开发者们最关心的事情之一了. 在网上搜一搜,很多有不少的第三方工具可以为源代码加密.加密方式不外乎就是混淆,加壳. 理论上, ...
- arguments.callee 调用函数自身用法----JSON.parse()和JSON.stringify()前端js数据转换json格式
arguments.callee 调用函数自身用法 arguments.callee 在哪一个函数中运行,它就代表哪个函数. 一般用在匿名函数中. 在匿名函数中有时会需要自己调用自己,但是由于是匿名函 ...