A. Alena's Schedule

间隔0长度为1被记录  1被记录  其余不记录

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
int main()
{
int t;
cin>>t;
int pre = ;
int a = ,ans= ;
bool mk = false;
while(t--)
{
cin>>a;
if(a)
{
if(pre<)
ans+=pre;
pre=;
ans+=;
mk=true;
}
else{
if(mk)
{
pre++;
}
}
}
cout<<ans<<endl;
return ;
}

AC代码

B. Laurenty and Shop

前缀后缀枚举转折点。

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <climits>
using namespace std;
int a[],b[];
int main()
{
int t;
cin>>t;
int x;
for(int i=;i<t;i++) // 0 1 2 3
{
cin>>x;
a[i] = a[i-] + x;
}
for(int i=;i<t;i++) // 0 1 2 3
{
cin>>x;
b[i] = b[i-] + x;
}
vector<int>v;
for(int i=;i<t;i++)
{
cin>>x;
v.push_back(a[i]+b[t-]-b[i]+x);
}
sort(v.begin(),v.end());
cout<<v[]+v[]<<endl;
return ;
}

AC代码

C. Gennady the Dentist

读不懂  模拟题

D. Phillip and Trains

每次向右走一格,所以我们只要确定他活过m轮,就一定到达终点。//

判断车的位置   当前位置加2×t   车的位置不容易改变所以我们把自己加上2×t相当于车往左走了2×t  判断是否合法即可

比赛的时候vis标记位置放错....还是太菜了呢

就是太菜,不想找什么英语差的借口了

#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
bool vis[][];
char ch[][];
int n,m;
typedef pair<int,int> pii;
bool check(int x,int y,int dir,int t,vector<pii>& now)
{
int nx = dir+x;
int ny = y+;
if(nx<||nx>=n||ny<||ny>=m||vis[nx][ny]) return false;
int a,b,c;
a = (y+*t+);
b = (a+);
c = (b+);
if(dir)
{
if((a<m&&ch[x][a]!='.')) return false;
}
if((a<m&&ch[nx][a]!='.')||(b<m&&ch[nx][b]!='.')||(c<m&&ch[nx][c]!='.')) return false;
now.push_back(make_pair(nx,ny));
vis[nx][ny] = true;
return true;
} bool bfs(int x,int y)//shijiweizhi
{
vector<pii>now,nxt;
now.push_back(make_pair(x,y));
int time = ;
vis[x][y] = true;
while(now.size())
{
if(time>=m) break;
for(int i=;i<now.size();i++)
{
//printf("%d %d %d",time,now[i].first,now[i].second);
for(int j=-;j<=;j++)
{
check(now[i].first,now[i].second,j,time,nxt);
}
}
swap(now,nxt);
nxt.clear();
time++;
}
return time>=m;
}
int main()
{
int t;
cin>>t;
while(t--)
{
memset(vis,,sizeof(vis));
memset(ch,,sizeof(ch));
int k;
scanf("%d%d",&m,&k);
n = ;
int sx,sy;
for(int i=;i<n;i++)
{
scanf("%s",ch[i]);
for(int j=;j<m;j++)
{
if(ch[i][j]=='s')
{
ch[i][j] = '.';
sx = i;
sy = j;
}
}
}
//cout<<sx<<sy<<endl;
if(bfs(sx,sy)) puts("YES");
else puts("NO");
}
return ;
}

AC代码

E. Alice, Bob, Oranges and Apples

每个人操作的次数就是GCD的过程

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <string.h>
#include <cctype>
#include <climits>
using namespace std;
typedef long long ll;
char ch = 'A';
bool mk;
ll gcd(ll a,ll b)
{
if(b==) return a;
ll val = a/b;
if(val)
{
if(a%b==) val--;
if(val)
{
cout<<val<<char(ch+mk);
mk = !mk;
}
} return gcd(b,a%b);
}
int main()
{
ll x,y;
cin>>x>>y;
mk = x<y;
if(__gcd(x,y)!=)
{
printf("Impossible");
}
else{
gcd(x,y);
}
return ;
}

AC代码

Codeforces Round #325 垫底纪念的更多相关文章

  1. Codeforces Round #325 (Div. 2) F. Lizard Era: Beginning meet in the mid

    F. Lizard Era: Beginning Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/5 ...

  2. Codeforces Round #325 (Div. 2) D. Phillip and Trains BFS

    D. Phillip and Trains Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/ ...

  3. Codeforces Round #325 (Div. 2) C. Gennady the Dentist 暴力

    C. Gennady the Dentist Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586 ...

  4. Codeforces Round #325 (Div. 2) A. Alena's Schedule 水题

    A. Alena's Schedule Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/pr ...

  5. Codeforces Round #325 (Div. 2) B. Laurenty and Shop 前缀和

    B. Laurenty and Shop Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/586/p ...

  6. Codeforces Round #325 (Div. 2) Phillip and Trains dp

    原题连接:http://codeforces.com/contest/586/problem/D 题意: 就大家都玩过地铁奔跑这个游戏(我没玩过),然后给你个当前的地铁的状况,让你判断人是否能够出去. ...

  7. Codeforces Round #325 (Div. 2) Laurenty and Shop 模拟

    原题链接:http://codeforces.com/contest/586/problem/B 题意: 大概就是给你一个两行的路,让你寻找一个来回的最短路,并且不能走重复的路. 题解: 就枚举上下选 ...

  8. Codeforces Round #325 (Div. 2) Alena's Schedule 模拟

    原题链接:http://codeforces.com/contest/586/problem/A 题意: 大概就是给你个序列..瞎比让你统计统计什么长度 题解: 就瞎比搞搞就好 代码: #includ ...

  9. Codeforces Round #325 (Div. 2) D bfs

    D. Phillip and Trains time limit per test 1 second memory limit per test 256 megabytes input standar ...

随机推荐

  1. mysql优化思路

    /* mysql优化思路     1.数据库设计     2.sql语句优化     3.数据库参数设置     4.恰当的硬件资源和操作系统        数据库设计         数据的3NF( ...

  2. WeX5学习笔记-建立项目且从SVN获取版本

    UI2项目(app项目)建立步骤: 1.从网上获得WeX5_V3.1.1.zip 文件,在某盘根目录下,创建一个文件,起名尽量短小,因开发包里的文件目录层次很深,有时会报路径长度超出范围的提示,如创建 ...

  3. linux下生成rsa密钥的方法

    首先生成密钥,用命令ssh-keygen –t rsa 运行后可以一直空格,生成密钥,id_rsa和id_rsa.pub文件 ,默认放在/root/.ssh/下,.ssh文件是隐藏的,要显示隐藏文件才 ...

  4. 【uTenux实验】互斥体

    互斥体,维基百科中交互斥锁.其定义是这样的:互斥锁(英语:英语:Mutual exclusion,缩写 Mutex)是一种用于多线程编程中,防止两条线程同时对同一公共资源(比如全局变量)进行读写的机制 ...

  5. GC之六--SystemGC完全解读

    概述 JVM的GC一般情况下是JVM本身根据一定的条件触发的,不过我们还是可以做一些人为的触发,比如通过jvmti做强制GC,通过System.gc触发,还可以通过jmap来触发等,针对每个场景其实我 ...

  6. 【转】抛弃EF,20分构建一个属于自己的ORM框架

    链接:http://www.cnblogs.com/irenebbkiss/p/4157364.html

  7. [ActionScript 3.0] AS3.0 火焰效果

    package { import flash.display.Sprite; import flash.display.* import flash.events.Event; import flas ...

  8. 为什么在注册和注销的时候intent要改成隐式调用

    显式意图:调用Intent.setComponent()或Intent.setClass()方法明确指定了组件名的Intent为显式意图,显式意图明确指定了Intent应该传递给哪个组件. 隐式意图: ...

  9. FPGA边缘检测

    沿检测技术在项目应用中, 非常低广泛. 如要有效捕获信号跳变沿, 边沿 检测技术的应用是必不可少的.大致如下: (1) 将时钟边沿使能转换为边沿检测使能,使时钟同步化. (2) 捕获信号的突变( UA ...

  10. CyclicBarrier类合唱演绎

    package a.jery; import java.util.concurrent.CyclicBarrier; import java.util.concurrent.ExecutorServi ...