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 ...
随机推荐
- Gym - 101670F Shooting Gallery(CTU Open Contest 2017 区间dp)
题目&题意:(有点难读...) 给出一个数字序列,找出一个区间,当删除这个区间中的两个相同的数字后,只保留这两个数字之间的序列,然后继续删除相同的数字,问最多可以实行多少次删除操作. 例如: ...
- Eclipse添加背景图片
①前言:我本人是一个比较喜新厌旧的人,经常换头像,背景图片之类的,喜欢折腾,哈哈,所以每次都上网查怎么修改背景图片比较麻烦,这里也记录一下怎么修改. ②原文链接:https://yq.aliyun.c ...
- 每日命令:(2)cd
Linux cd 命令可以说是Linux中最基本的命令语句,其他的命令语句要进行操作,都是建立在使用 cd 命令上的. 所以,学习Linux 常用命令,首先就要学好 cd 命令的使用方法技巧. 1. ...
- Flask项目中整合各组件
一.介绍 主要介绍flask_sqlalchemy.flask_script.flask_migrate这三个组件该如何整合到flask项目中,以及如何使用. # 安装组件 pip3 install ...
- 1031. Hello World for U
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. ...
- Delphi语法
类与对象 从用户角度考虑,用户并不需要了解面向对象编程的知识,就可编写Delphi应用程序.当用户在建立新窗体.添加新组件以及处理事件时,大部分相关代码会由Delphi自动产生.但是,知道语言及其细节 ...
- [luoguP2782] 友好城市(DP)
传送门 转化成 lis 后 n2 搞就行 ——代码 #include <cstdio> #include <iostream> #include <algorithm&g ...
- node.js 发布订阅模式
//导入内置模块 let EventEmitter = require('events'); let util=require('util'); //Man继承EventEmitter util.in ...
- 【Chrome】Chrome浏览器怎么查看版本信息
第一步,打开Chrome浏览器 第二步,弹出浏览器主界面 第三步,点击右上按钮(三横杠) 第四步,下拉中选择“关于” 第五步,弹出窗口,可以看到版本信息 第二种方法: 第六步,也可以通过地址栏里输入命 ...
- PHP htmlentities 和 htmlspecialchars的区别
一直对这两个转换htm字符为html实体的函数混淆不清,查询了一下文档,总结如下 htmlentities: Convert all applicable characters to HTML ent ...