补题解:

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. 限制<input>输入内容 只允许数字 或者 字母

    只能输入数字: 有回显 <input onkeyup="value=value.replace(/[^\d]/g,'')"> 只能输入数字:无回显 <input ...

  2. vagrant

    puppet chef ansible salt docker https://github.com/ansible/ansiblehttps://github.com/saltstack/salth ...

  3. Win8.1想要卸载openSUSE出现问题(2014.8.15已解决)

    用DiskGenius激活C盘后果然好用了!随便用EasyBCD恢复一下就好了 下面再说说安装openSUSE这半周多的问题: 1.如果是NVIDIA和Intel双显卡就不要安装NVIDIA的显卡驱动 ...

  4. 发布web项目时,忽略指定文件夹或文件

    参考:http://blogs.msdn.com/b/webdev/archive/2010/04/22/web-deployment-excluding-files-and-folders-via- ...

  5. java下的redis操作

    Java操作redis(增删改查) Java代码 package sgh.main.powersite; import java.util.ArrayList; import java.util.Ha ...

  6. uva 11922 Permutation Transforme/splay tree

    原题链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=18902 伸展树的区间翻转剪切... 如下: #include< ...

  7. 直播源格式转换教程——rtmp/rtsp/http/m3u8!!

    之前寻找直播源,发现好多rtmp开头的,或者是rtsp开头的,但是ATV里面的个人链接是支持m3u8格式的.怎么办?小编发现了几个规律,网友可作参考.现在流行的直播地址差不多就这几种需要说明的是并不是 ...

  8. iOS 各种系统文件目录 临时,缓存,document,lib,归档,序列化

    /** 1:Documents:应用中用户数据可以放在这里,iTunes备份和恢复的时候会包括此目录 2:tmp:存放临时文件,iTunes不会备份和恢复此目录,此目录下文件可能会在应用退出后删除 3 ...

  9. Redis 客户端配置及示例

    一.redis自定义配置节点 <configSections> <section name ="RedisConfig" type="Amy.Toolk ...

  10. 14.quartus联合modelsim仿真

    在quartus调用modelsim仿真过程中,出现了一个错误,如下所示: Check the NativeLink log file I:/Quartus11.0/Myproject/testi_n ...