记次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. 【html】【11】函数名称约束规范

    一.匈牙利命名法: [不推荐]基本原则是:变量名=属性+类型+对象描述,其中每一对象的名称都要求有明确含义,可以取对象名字全称或名字的一部分.要基于容易记忆容易理解的原则.保证名字的连贯性是非常重要的 ...

  2. Ext 面向对象程序设计 入门篇

    ------ 命名空间 定义:对于类的组织定义方式代码: Ext.namespace("Ext.xgao"); ------ 类实例属性 定义:对于一个实例的特征描述代码: Ext ...

  3. js搜索框 js仿百度搜索 js下拉框 jQuery.Autocomplete使用

    做了一个网站,需要根据文本框的输入模糊搜索数据库内容给出提示供用户选择,就找到了jQuery.Autocomplete 效果如下图: 该插件托管在github上,具体地址:https://github ...

  4. Javascript访问css样式信息

    DOM2级样式为style对象定义了一些属性和方法,可以通过这些方法属性来访问或者修改元素的样式信息: 1.cssText:可读写,在读的情况下以字符串形式返回元素的css代码,在写的情况下以字符串形 ...

  5. JavaScript 判断用户输入的邮箱及手机格式是否正确

    JavaScript判断用户输入的邮箱格式是否正确.判断用户输入的手机号格式是否正确,下面有个不错的示例,感兴趣的朋友可以参考下. 复制代码代码如下: /*  * 功能:判断用户输入的邮箱格式是否正确 ...

  6. 微信支付JS API使用心得

    微信的接口真的很坑爹,只返回成功或失败,从来不会告诉你为什么失败.这个微信支付的js接口也是调了一个下午才成功,期间踩了不少坑,在这里总结一下,而且把支付接口封装成了一个js文件,这样以后调用就很方便 ...

  7. C++ 实现设计模式之观察者模式

    1. 什么是观察者模式? 观察者模式(有时又被称为发布-订阅Subscribe>模式.模型-视图View>模式.源-收听者Listener>模式或从属者模式)是软件设计模式的一种.在 ...

  8. ubuntu系统软件

    1.办公软件:wps 2.浏览器:firefox,opera 3.思维导图:xmind 如果您有好的软件,请推荐给我,谢谢!

  9. extern "C"的作用

    一.概述 在C语言的头文件中,经常可以看到如下的代码,那这个是什么作用呢? #ifdef __cplusplus extern "C" { #endif /*...*/ #ifde ...

  10. Unity3d Shader开发(一)Properties

    着色器可以定义一个参数列表,可以由开发者在材质检视面板编辑参数.着色器文件中的Properties块定义了这些参数: 语法: Properties { Property [Property ...] ...