记次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. C#构造函数相关主题

    using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threa ...

  2. 在 Eclipse 中使用 JSHint 检查 JavaScript 代码

    JSHint Home: http://www.jshint.com/ JSHint Options: http://www.jshint.com/options/ JSHint For Eclips ...

  3. Shell/Bash 变量/variable 循环/loop

    如何在bash脚本里面进行循环 #!/bin/bash n=9999 for(( i =1; i<=100;i++)) do /root/testProgram $n sleep 5 n=$(( ...

  4. How to: Reading an ini config file from a batch file

    Original Link: http://almanachackers.com/blog/2009/12/31/reading-an-ini-config-file-from-a-batch-fil ...

  5. [Guava官方文档翻译] 5. Guava的Object公共方法 (Common Object Utilities Explained)

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3537367.html,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体验 ...

  6. 模板方法模式(Template Pattern)

    模板方法模式:在一个方法中定义一个算法的骨架,而将一些步骤延迟到子类中.模板方法使得子类可以在不改变算法的结构下,重新定义算法中的某些步骤. 这个模式是用来创建一个算法模板.模板就是一个方法.更具体地 ...

  7. hdu 1576 A/B

    原题链接:hdu 1576 A/B 同样是用扩展的欧几里得算法.A = 9973k+n = xB,从而转化为:xB-9973k=n求解x即可. 具体扩展欧几里得算法请参考:hdu 2669 Roman ...

  8. leetcode problem 33 -- Search in Rotated Sorted Array

    Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 migh ...

  9. Cloudcraft: 云架构图形可视化(智能AWS图表)

    Cloudcraft: 云架构图形可视化(智能AWS图表) 2016.09.11 官方网站: https://cloudcraft.co/ Cloudcraft是一个Web应用,用图形表示各种AWS服 ...

  10. platform_driver_register()--如何match之后调用probe

    int platform_driver_register(struct platform_driver *drv) { drv->driver.bus = &platform_bus_t ...