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 ...
随机推荐
- python爬虫30 | scrapy后续,把「糗事百科」的段子爬下来然后存到数据库中
上回我们说到 python爬虫29 | 使用scrapy爬取糗事百科的例子,告诉你它有多厉害! WOW!! scrapy awesome!! 怎么会有这么牛逼的框架 wow!! awesome!! 用 ...
- Batchelor Prize
awards in fluid mechanics The Prize of $25,000 is awarded every four years to a single scientist for ...
- [luoguP1069] 细胞分裂(数论)
传送门 分解质因数,不说了 这题坑了我2个多小时 教训 不熟悉位运算的优先级一定要加括号!!!! #include <cstdio> #include <iostream> # ...
- CodeForces 220B(B. Little Elephant and Array)
http://codeforces.com/contest/220/problem/B 题意:给出一个数组,给出m组询问,问区间中出现a[i] 次的有多少个. sl: 很显然的离线问题了. 大视野菜花 ...
- POJ 3630
Phone List Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20894 Accepted: 6532 Descripti ...
- [K/3Cloud] KSQL 关联表更新字段Update语法
关联表更新字段 UPDATE tmp369faa3f7d224b0595670425008 as t1 SET FStatus=-1 where exists(select 1 from t_BD_S ...
- android从sdcard中读取bitmap
String sdcard_path=Environment.getExternalStorageDirectory().getCanonicalPath(); String file_path=sd ...
- 五语言学习系列 C,C++,Objective-C,Java,C# (一)历史
C:由AT&T贝尔实验室的Dennis Ritchie于1972年创建的,是专为开发者设计的语言. C++:在C基础上,1983年又由贝尔实验室的Bjarne Strou-strup推出了C+ ...
- Linux 使用pwgen命令创建随机密码
https://blog.csdn.net/fdipzone/article/details/73864598 http://www.netkou.com/?post=155
- W3School Redis教程(安装/基本操作/高级操作/命令/官方文档/官方集群教程)
说明:Redis有自身的客户端连接软件,也可以使用Telnet进行连接操作. 来自W3School的Redis教程,基本上涵盖了从安装到状态监控的教程. W3School:https://www.gi ...