记次CF吧 1题。。。B题。。因为循环的i没设成long long 却参与了运算 结果就悲剧了 一直交 一直挂 。。上题

A 水。。 第一次少了个空格还。。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<stdlib.h>
#include<algorithm>
using namespace std;
#define LL long long
LL x,y;
int main()
{
int i,j,k,n,m;
cin>>x>>y;
if((x<&&y>)||(x>&&y<))
{
LL b = y-x;
if(b<)
cout<<""<<" "<<b<<" "<<-b<<" "<<""<<endl;
else
cout<<-b<<" "<<"0 "<<""<<" "<<b<<endl;
}
else
{
LL b = y+x;
if(b>)
cout<<""<<" "<<b<<" "<<b<<" "<<""<<endl;
else
cout<<b<<" "<<""<<" "<<"0 "<<b<<endl;
}
return ;
}

B题 大体画画 就出来了 求下和加加

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#include<cmath>
using namespace std;
#define eps 1e-6
int main()
{
long long m,r,i;
cin>>m>>r;
double s =,s1=;
for(i = ; i <= m ; i++)
{
s = ;
if(i>)
s+=(i-)*(i-)*r+(i-2.0)*sqrt(2.0)**r+sqrt(2.0)*r+*r;
else
s+=(i-)*i*r+(i-)*sqrt(2.0)*r;
if(m-i>=)
s+=(m-i-)*(m-i)*r+(m-i-)*sqrt(2.0)**r+*r+sqrt(2.0)*r+*r;
else
s+=(m-i)*(m-i+)*r+(m-i)*sqrt(2.0)*r+*r;
s1+=s/m;
}
printf("%.10f\n",s1/m);
return ;
}

往后就没再看 一直在交B 7次WA啊啊 泪~~

补道C题

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
#define N 100010
#define LL long long
using namespace std;
struct node
{
LL a;
int d[],k;
}q[N];
int f[];
void digit(int e)
{
int g=;
LL y = q[e].a;
while(y)
{
int x = y%;
g++;
q[e].d[g] = x;
y/=;
}
q[e].k = g;
}
bool cmp(node a,node b)
{
return a.a<b.a;
}
int main()
{
int i,j,k,n,o,g;
cin>>n;
for(i = ; i <= n ;i++)
{
scanf("%d",&q[i].a);
digit(i);
}
sort(q+,q+n+,cmp);
o = ;
for(i = ; i >= ; i--)
{
memset(f,,sizeof(f));
for(j = n; j >= ; j--)
{
if(q[j].k<i)
break;
if(q[j].d[i]!=)
{
for(g = ; g < q[j].k ; g++)
if(q[j].d[g]==)
f[g] = ;
}
}
for(g = ; g < i ; g++)
if(!f[g]) break;
if(g==i)
{
o = g;
break;
}
}
int num = ;
for(i = n ; i >= ; i--)
if(q[i].d[o]==)
num++;
cout<<num<<endl;
int w=;
for(i = n ; i >= ; i--)
if(q[i].d[o]==)
{
if(w)
printf(" ");
w++;
cout<<q[i].a;
}
return ;
}

补道D题

根据费马小定理神马的求逆元 然后高端的算组合数取模

若第一个是1 则最后为0  若全是0且为偶数-》1 否则-》0 组合起来就可以求解了

100。。。。

0100。。

0010。。

0001。。。

 #include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<stdlib.h>
using namespace std;
#define mod 1000000007
#define LL long long
LL ff[];
LL fmod(LL a,LL k)
{
LL b = ;
while(k)
{
if(k&)
b = a*b%mod;
a = (a%mod)*(a%mod)%mod;
k/=;
}
return b;
}
LL cn(int n,int m)
{
LL ans,a;
ans = ff[n];
a = fmod((ff[n-m]*ff[m])%mod,mod-);
return (ans*a)%mod;
}
int main()
{
int i,j,k,n,m,g;
while(cin>>n>>m>>g)
{
LL s1=,s2=;
if(n==)
{
if(m==&&g==)
cout<<"1\n";
else if(m>&&g==)
cout<<"0\n";
else if(m==&&g==)
cout<<"0\n";
else
cout<<"1\n";
continue;
}
else if(m==)
{
if(n%==)
k = ;
else
k = ;
if(k==g)
cout<<"1\n";
else
cout<<"0\n";
continue;
}
ff[] = ;
for(i = ;i <= n+m;i ++)
{
ff[i] = (ff[i-]*i)%mod;
}
s1 = cn(n+m,m);
for(i = ;i <= n ; i+=)
{
if(m+n-i->=m-)
s2=(s2+cn(m+n-i-,m-))%mod;
}
if(m==&&n%!=)
s2++;
if(m==&&n%==)
s2--;
if(g==)
cout<<s2<<endl;
else
{
if(s1-s2<)
s1 = s1-s2+mod;
else
s1 = s1-s2;
cout<<s1<<endl;
}
}
return ;
}

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

  1. Codeforces Round #195 (Div. 2) A. Vasily the Bear and Triangle

    水题,注意数据范围即可 #include <iostream> #include <algorithm> #include <utility> using name ...

  2. Codeforces Round #195 (Div. 2) D题Vasily the Bear and Beautiful Strings

    这场CF,脑子乱死啊...C题,搞了很长时间,结束了,才想到怎么做.B题,没看,D题,今天看了一下,很不错的组合题. 如果n和m都挺多的时候 以下情况都是变为1,根据偶数个0,最后将会为1,奇数个0, ...

  3. Codeforces Round #195 (Div. 2) 少部分题解

    太困了于是没做...第二天看题蘑菇题居多就只切了简单的两个... A:直接输出... int main() { //FIN; //FOUT; int x,y; cin>>x>> ...

  4. 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 ...

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

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

  6. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

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

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

  8. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  9. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

随机推荐

  1. RTTI(Runtime Type Information )

    RTTI 是“Runtime Type Information”的缩写,意思是:运行时类型信息.它提供了运行时确定对象类型的方法.本文将简略介绍 RTTI 的一些背景知识.描述 RTTI 的概念,并通 ...

  2. mysql与Navicat for MySQL的衔接配置问题【原创】

    首先改一下php的配置文件: 这里主要该两个地方:Cirl + F 查找到mysql.dll 然后去掉前面的";" 然后是修改路径:Cirl + F 查找到extension_di ...

  3. dd命令测试linux磁盘读写速度

    1.先熟悉两个特殊的设备:    (1)/dev/null:回收站.无底洞.    (2)/dev/zero:产生字符. 2.测试磁盘写能力    time dd if=/dev/zero of=/t ...

  4. JSON字符串转换为JSON对象

    一.JSON字符串转换为JSON对象 A:eval函数 eval函数可以直接将本质符合或者近似符合JSON格式的字符串转换为JSON对象,使用方式如: eval('(' + str + ')'); / ...

  5. Hash算法初见

    hash算法 (hashmap 实现原理)   Hash ,一般翻译做“ 散列” ,也有直接音译为“ 哈希” 的,就是把任意长度的输入(又叫做预映射, pre-image ),通过散列算法,变换成固定 ...

  6. [HTML] <input> 标签

      可选的属性 属性 值 描述 accept mime_type 规定通过文件上传来提交的文件的类型. align left right top middle bottom 不赞成使用.规定图像输入的 ...

  7. win7环境下配置Java环境

    ==下载Java SE Development Kit 8u45== http://www.oracle.com/technetwork/java/javase/downloads/jdk8-down ...

  8. RSA使用 常识

    1公钥加密,私钥解密  OK反过来, 私钥加密,公钥解密 也OK 2 使用RSA加密 对称算法的key ,用对称算法加密 消息.伙伴收到消息后,RSA解密出 对称算法的key,再用这个key去解密消息 ...

  9. android实现视频图片取缩略图

    取缩略图不等同于缩放图片. 缩放图片是保持不失真的情况下缩放处理,并进行平滑处理. 缩略图则不然,允许失真,目的只是取出图片的轮廓. 保存Bitmap图片 private void saveBitma ...

  10. python使用psutil获取服务器信息

    >>> import psutil 获取cpu信息>>> psutil.cpu_times()scputimes(user=128258.38, nice=12.2 ...