记次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. UITableViewCell和UITableViewHeaderFooterView的重用

    不管是系统自带的还是自定义的UITableViewCell,对于它们合理的使用都是决定一个UITableView的性能的关键因素.应该确保以下三条: UITableViewCell的重复利用:首先对象 ...

  2. asp:时间的显示

    DateTime dt = DateTime.Now;//    Label1.Text = dt.ToString();//2005-11-5 13:21:25//    Label2.Text = ...

  3. 【html】【8】div布局[子div在父div居底]

    从今天起 开始细话div布局   思路及要点: 父div的位置设置成相对的,即“position: relative;”. 而子div的位置设置成绝对的,并且下边缘设为0,即“position: ab ...

  4. Xml通用操作类

    using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Xml ...

  5. css important

    !important是CSS1就定义的语法,作用是提高指定样式规则的应用优先权.语法格式{ cssRule !important },即 写在定义的最后面,例如:box{color:red !impo ...

  6. Extension method for type

    扩展其实真的很简单 msdn是这样规定扩展方法的:"扩展方法被定义为静态方法,但它们是通过实例方法语法进行调用的. 它们的第一个参数指定该方法作用于哪个类型,并且该参数以 this 修饰符为 ...

  7. DatePicker (JQ-UI) 的z-index问题

    使用jq-ui的 datepicker ,发现日期弹出层被 <div class="fixed" style="z-index: 2; position: abso ...

  8. 1.Bloom filter

    Bloom filter 是由 Howard Bloom 在 1970 年提出的二进制向量数据结构,它具有很好的空间和时间效率,被用来检测一个元素是不是集合中的一个成员,这种检测只会对在集合内的数据错 ...

  9. [Linux/Ubuntu] vi/vim 使用方法讲解(转载)

    转自:http://www.cnblogs.com/emanlee/archive/2011/11/10/2243930.html vi/vim 基本使用方法 vi编辑器是所有Unix及Linux系统 ...

  10. win2003 sp2+iis 6.0上部署.net 2.0和.net 4.0网站的方法

    网站环境 IIS6.0,操作系统Windows server2003 sp2,服务器之前已经部署了.net 2.0和asp的网站,现在要部署新开发的.net 4.0网站.本来认为很简单,却遇到了很多问 ...