codeforces——数学
codeforces 805A http://codeforces.com/problemset/problem/805/A
/*
题意:输入两个整数l,r,让你找一个因子
使得[l,r]里面所有的数,能整除这个因子的数最多,输出这个因子
如果答案有多个,输出任意一个
*/
#include<iostream>
#include<cstdio>
#include<cstring> using namespace std; int l,r,cnt1,cnt2; int main()
{
scanf("%d%d",&l,&r);
if(l!=r) printf("2\n");
else printf("%d\n",l);
return ;
}
难度系数:0.1
codeforces 804E http://codeforces.com/problemset/problem/804/E (数学构造)
/*
题意:给出一个1到n的排列,问每两个位置都进行一次交换最终排列不变是否可能,
如果可能输出交换顺序。 表示并不会,看了题解后还是一知半解,代码实现也是不懂...
好吧我智商低,太弱了
大概就是4的倍数一定行,模4余1一定行(以为4一定行,第五个数跟每个都换一遍貌似也行)
反正好神奇,好扯淡...
*/
#include <bits/stdc++.h>
#define xx first
#define yy second
#define mp make_pair
#define pb push_back
#define fill( x, y ) memset( x, y, sizeof x )
#define copy( x, y ) memcpy( x, y, sizeof x )
using namespace std; typedef long long LL;
typedef pair < int, int > pa; inline int init()
{
int sc = , f = ; char ch = getchar();
while( ch < '' || ch > '' ) { if( ch == '-' ) f = -; ch = getchar(); }
while( ch >= '' && ch <= '' ) sc = sc * + ch - '', ch = getchar();
return sc * f;
} int main()
{
int n = init();
if( n % > ) return puts( "NO" ), ;
puts( "YES" );
for( int i = n % ; i < n ; i += )
{
for( int j = ; j < i ; j++ ) printf( "%d %d\n", j + , i + );
printf( "%d %d\n", i + , i + );
for( int j = i - ; ~j ; j-- ) printf( "%d %d\n", j + , i + );
for( int j = ; j < i ; j++ ) printf( "%d %d\n", j + , i + );
printf( "%d %d\n", i + , i + );
for( int j = i - ; ~j ; j-- ) printf( "%d %d\n", j + , i + );
printf( "%d %d\n", i + , i + );
printf( "%d %d\n", i + , i + );
printf( "%d %d\n", i + , i + );
printf( "%d %d\n", i + , i + );
}
}
我不会...
codeforces——数学的更多相关文章
- Codeforces Round #284 (Div. 2)A B C 模拟 数学
A. Watching a movie time limit per test 1 second memory limit per test 256 megabytes input standard ...
- Codeforces Bubble Cup 8 - Finals [Online Mirror]H. Bots 数学
H. Bots Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/H Desc ...
- Codeforces 715A & 716C Plus and Square Root【数学规律】 (Codeforces Round #372 (Div. 2))
C. Plus and Square Root time limit per test 2 seconds memory limit per test 256 megabytes input stan ...
- 【数学】Codeforces 707C Pythagorean Triples
题目链接: http://codeforces.com/problemset/problem/707/C 题目大意: 给你一个数,构造其余两个勾股数.任意一组答案即可,没法构造输出-1. 答案long ...
- 【数学相关、规律】Codeforces 696B Puzzles
题目链接: http://codeforces.com/problemset/problem/696/B 题目大意: 给一棵树,从根节点开始递归,time=1,每次递归等概率随机访问这个节点的子节点, ...
- codeforces#253 D - Andrey and Problem里的数学知识
这道题是这种,给主人公一堆事件的成功概率,他仅仅想恰好成功一件. 于是,问题来了,他要选择哪些事件去做,才干使他的想法实现的概率最大. 我的第一个想法是枚举,枚举的话我想到用dfs,但是认为太麻烦. ...
- Codeforces 1091D New Year and the Permutation Concatenation 找规律,数学 B
Codeforces 1091D New Year and the Permutation Concatenation https://codeforces.com/contest/1091/prob ...
- Codeforces Beta Round #97 (Div. 1) C. Zero-One 数学
C. Zero-One 题目连接: http://codeforces.com/contest/135/problem/C Description Little Petya very much lik ...
- 贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
题目传送门 /* 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 */ #include <cstdio> #include <al ...
随机推荐
- 洛谷——P1516 青蛙的约会
P1516 青蛙的约会 题目描述 两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面.它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止.可是它们出发之前忘记了一件 ...
- POJ3616 Milking Time【dp】
Description Bessie is such a hard-working cow. In fact, she is so focused on maximizing her producti ...
- Libreswan软件的密钥协商协议IKEv1主模式实现分析
Libreswan软件的密钥协商协议IKEv1主模式实现分析 1 协商过程 IKEv1(互联网密钥交换协议第一版)是IPsec VPN隧道协商使用的标准密钥协商协议,其协商过程如下图所示. 总共来回交 ...
- 小数化分数的O(log2n)解法
具体约束: 给定一个小数x,x满足0<=x<1,且保证给定的x保留了18位小数 输出一个分数,使得分母不超过1e9,分子分母互质,且在满足这些条件的情况下最接近x 了解一下法雷数列和ste ...
- yarn & vue-cli
yarn & vue-cli https://github.com/xgqfrms/ES6/issues/10 install https://yarnpkg.com/zh-Hans/docs ...
- Bellman-ford算法的学习http://blog.csdn.net/niushuai666/article/details/6791765
http://blog.csdn.net/niushuai666/article/details/6791765
- Snail—UI学习之自己定义通知NSNotification
背景是:一个界面跳转到第二个界面 然后 第一个界面发了一个通知 然后第二个界面收到这个通知后 把里面的数据取出来 在RootViewController.m中写入以下代码 #import " ...
- FTP用户-禁止登录系统
OS是Ubuntu 11.10. 1. which nologin #/usr/sbin/nologin 2. vim /etc/shells #在该文件后添加/usr/sbin/nolo ...
- Ubuntu下用hadoop2.4搭建集群(伪分布式)
要真正的学习hadoop,就必需要使用集群,可是对于普通开发人员来说,没有大规模的集群用来測试,所以仅仅能使用伪分布式了.以下介绍怎样搭建一个伪分布式集群. 为了节省时间和篇幅,前面一些步骤不再叙述. ...
- 正确移除List中对象
list是一个ArrayList的对象,哪个选项的代码填到//todo delete处.能够在Iterator遍历的过程中正确并安全的删除一个list中保存的对象?() Iterator it = l ...