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使用Flask框架,结合Highchart,搭配数据功能模块处理csv数据
参考链接:https://www.highcharts.com.cn/docs/data-modules 1.javascript代码 var csv = document.getElementByI ...
- Linux学习笔记(六) 进程管理
1.进程基础 当输入一个命令时,shell 会同时启动一个进程,这种任务与进程分离的方式是 Linux 系统上重要的概念 每个执行的任务都称为进程,在每个进程启动时,系统都会给它指定一个唯一的 ID, ...
- CCF201612-1 中间数 java(100分)
试题编号: 201612-1 试题名称: 中间数 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 在一个整数序列a1, a2, …, an中,如果存在某个数,大于它的整数数量等 ...
- centos7在grub界面下更改root密码
想要更改root的密码或者忘记了root的密码的时候可以在grub界面下更改root的密码. 百度了很多内容,更多方法都是适用于centos6及以前版本的,终于找到一个可以的. 1.开机后,在下图界面 ...
- flex多列布局遇到的问题,和解决方案
flex布局无疑是简单.易用的,他让我我们的布局更加简单和快速,但是在使用flex进行多列布局的时候,我相信很多人会遇到下面的情况: 这种情况是因为我们使用了justify-content: spac ...
- 洛谷 2146 [NOI2015]软件包管理器
[题解] 每个软件只依赖另一个软件,且依赖关系不构成环,那么很容易想到这是树形结构. 我们用1表示以安装,用0表示未安装或已卸载:那么安装一个软件,就是把它到树根的路径上所有的点都改为1:卸载一个软件 ...
- 【Codeforces 246D】Colorful Graph
[链接] 我是链接,点我呀:) [题意] 让你找到所有和x颜色的点中,和该颜色的点颜色不同的相邻的点的个数(重复颜色算一次) 求出哪种颜色的所要求的点的数量最多. [题解] 对于每一条边只会被查到两次 ...
- iOS消息推送原理和实现总结
一.消息推送原理: 在实现消息推送之前先提及几个于推送相关概念,如下图:1. Provider:就是为指定IOS设备应用程序提供Push的服务器,(如果IOS设备的应用程序是客户端的话,那么Provi ...
- MAPZONE GIS SDK接入Openlayers3之二——空间参考扩展
Openlayers默认了两种空间参考,一个是EPSG4326,一个是EPSG3857,其它的空间参考需要进行扩展才能使用.所以我们初始化时进行了如下操作: 1.将配置数据库中所有的空间参考读取出来, ...
- eclipse的Java项目修改后要不要重启tomcat问题
tomcat服务器重新部署工程或者修改了项目的代码就必须重启tomcat吗? 答: omcat服务器重新部署工程或者修改了项目的代码就必须重启tomcat吗?有没有不重启的方法,或者其他高效点的,让服 ...