补题解:

E:只会第四种解法;也只看懂了这一种。

PS:F[X+10^18]=F[X]+1;F[X]表示X的数字之和;

假设X,F[10^18+X]+F[10^18+X-1]+......F[10^18+1]=F[1]+.....+F[X]+X;

这个应该没问题所以有G[10^18+X]-G[10^18]=G[X]+X;

G[X]表示:1-X的数字和的总和;

根据G[10^X]=45*X*10^(X-1);所以G[10^18]=45*18*10^17;

所以G[10^18+X]-G[X]=(G[10^18]+X)%a;

然后就可以推出时X的大小,X=a-G[10^18]%a;

这样这题就完美解决;

 #include <stdio.h>
#include<iostream>
void solve(){
unsigned long long s = 100000000000000000ll;
__int64 p = s * ;
__int64 a;
scanf("%I64d",&a);
s = (s * ) % a;
s = (s * + ) % a;
a = a - s;
printf("%I64d %I64d\n", + a,p + a);
}
int main(){
solve();
return ;
}

D题:@狗哥有个好想法;

假如B>A;

那么对于一个数组最小的数X,如果能在B-X=PB找到他的匹配,那么不用再A中找到,

原因是假如X“嫁"给了A,在A中会有一个A-X=YA与之搭配。

但是PB就找不到”老婆“了,因为A-X<B-X,但是X已经是最小的,所以PB就无法对应了,

然后就是写法的问题了;

 #include<iostream>
#include<stdio.h>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<map>
#include<string>
typedef long long ll;
using namespace std;
int ans[];
map<int,int>mp; int n,a,b;
int pa,pb; int main()
{
cin>>n>>a>>b;
for (int i=;i<=n;i++)
{
int x;
cin>>x;
mp[x]=i;
}
int pa=,pb=;
if (a>b) swap(a,b),swap(pa,pb); for (map<int,int>::iterator mi=mp.begin();mi!=mp.end();mi++)
{
int val=mi->first;
int pos=mi->second;
if (ans[pos]) continue;
if (mp.find(b-val)!=mp.end()&&ans[mp[b-val]]!=pa)
ans[pos]=ans[mp[b-val]]=pb;
else if (mp.find(a-val)!=mp.end()&&ans[mp[a-val]]!=pb)
ans[pos]=ans[mp[a-val]]=pa;
else
{
cout<<"NO"<<endl;
return ;
}
}
cout<<"YES"<<endl;
for (int i=;i<=n;i++) cout<<ans[i]-<<" ";
return ;
}

C:我分奇数偶数;

因为1*2*3*4=24;

6-5=1;

8-7=1;

10-9=1;

发现了什么,

奇数也可以类推;

1,2,3,4,5手动找一下;

7-6=1;

9-8=1;

然后就可以了

B,A基本照着模拟就可以了

Codeforces Round #268 (Div. 2)的更多相关文章

  1. Codeforces Round #268 (Div. 2) ABCD

    CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...

  2. Codeforces Round #268 (Div. 1) B. Two Sets 暴力

    B. Two Sets Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/B ...

  3. Codeforces Round #268 (Div. 1) A. 24 Game 构造

    A. 24 Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/468/problem/A D ...

  4. 贪心+bfs 或者 并查集 Codeforces Round #268 (Div. 2) D

    http://codeforces.com/contest/469/problem/D 题目大意: 给你一个长度为n数组,给你两个集合A.B,再给你两个数字a和b.A集合中的每一个数字x都也能在a集合 ...

  5. Codeforces Round #268 (Div. 2) (被屠记)

    c被fst了................ 然后掉到600+.... 然后...估计得绿名了.. sad A.I Wanna Be the Guy 题意:让你判断1-n个数哪个数没有出现.. sb题 ...

  6. Codeforces Round #268 (Div. 1) 468D Tree(杜教题+树的重心+线段树+set)

    题目大意 给出一棵树,边上有权值,要求给出一个1到n的排列p,使得sigma d(i, pi)最大,且p的字典序尽量小. d(u, v)为树上两点u和v的距离 题解:一开始没看出来p需要每个数都不同, ...

  7. Codeforces Round #268 (Div. 2) D. Two Sets [stl - set + 暴力]

    8161957                 2014-10-10 06:12:37     njczy2010     D - Two Sets             GNU C++     A ...

  8. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  9. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

随机推荐

  1. 【转】 BSS段 数据段 代码段 堆栈 指针 vs 引用

    原文:http://blog.csdn.net/godspirits/article/details/2953721 BSS段 数据段 代码段 堆栈 (转+) 声明:大部分来自于维基百科,自由的百科全 ...

  2. LPHW-积累-ex1-6

    Learn Python The Hard Way  ex0  介绍了各个操作系统下python的安装:强调了初学者最好使用简单的编辑器,不要使用IDE环境 ex1 使用 print 输出简单的字符串 ...

  3. oracle11g rman验证备份有效性

    RMAN> restore validate controlfile; Starting restore at 21-NOV-13using target database control fi ...

  4. ASP.NET MVC如何实现自定义验证(服务端验证+客户端验证)

    ASP.NET MVC通过Model验证帮助我们很容易的实现对数据的验证,在默认的情况下,基于ValidationAttribute的声明是验证被使用,我们只需 要将相应的ValidationAttr ...

  5. Go语言类型switch

    switch还可以用于判断变量类型.使用方式为T.(type),即在变量后加上.(type).见代码: package main import ( "fmt" ) func mai ...

  6. centos 安装phantomjs

    sudo yum install gcc gcc-c++ make git openssl-devel freetype-devel fontconfig-devel git clone git:// ...

  7. generate the next AttestationNumber, 格式是ICD-EPRG-DEV-0000000001,ICD-EPRG-DEV-0000000002

    private static int GetNextAttestationNumber(string maxAttestationNumber) { //generate the next Attes ...

  8. Python实现ID3(信息增益)

    Python实现ID3(信息增益) 运行环境 Pyhton3 treePlotter模块(画图所需,不画图可不必) matplotlib(如果使用上面的模块必须) 计算过程 st=>start: ...

  9. 转Oracle字符集问题总结

    Oracle字符集问题总结 分类: Oracle2006-06-04 13:48 1298人阅读 评论(3) 收藏 举报 oracle数据库sqlcharacter存储insert 作者: vston ...

  10. Min Stack

    Min Stack Design a stack that supports push, pop, top, and retrieving the minimum element in constan ...