Codeforces1243C Tile Painting】的更多相关文章

原题面:https://codeforces.com/contest/1243/problem/C 题目大意:给定数字n,有n个方块,第i个和第j个之间的距离(abs(i-j))如果是n的因子,那么第i块和第j块颜色相同,统计一下最后有多少种不同颜色的方块. 输入描述:输入一个正整数n. 输出描述:输出一共有多少种颜色不同的方块. 输入样例1: 输出样例1: 输入样例2: 输出样例2: 分析:这个题猜了好几个结论才过了,我把它想的有点抽象,应该理解求最小循环节问题才对.这样就只用对n的所有因子求…
C. Tile Painting Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of…
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of nn consecutive tiles, numbered from 11 to nn. Ujan will paint each tile in some color…
Ujan has been lazy lately, but now has decided to bring his yard to good shape. First, he decided to paint the path from his house to the gate. The path consists of nn consecutive tiles, numbered from 11 to nn. Ujan will paint each tile in some color…
题意:给定长度为n的方块,要求染色,需要满足:当|j-i|>1且n%|j-i|==0时,两格颜色相同,求做多可以染多少种颜色 题解:求出n的所有质因子 1.若只有一种质因子,则答案为该质因子 2.若有两种以上的质因子,则答案为1 只有一种质因子时,相当于每隔若干个放同种颜色,则可以放p种颜色 有两种以上的质因子时,选取最小的两个质因子,那么只需要长度lcm(p1,p2)的格子,就可以让所有位置变成相同的颜色,且p1,p2是n的质因子,故lcm(p1,p2)≤n #include<iostrea…
题意:就是给你一个n,然后如果  n mod | i - j | == 0  并且 | i - j |>1 的话,那么i 和 j 就是同一种颜色,问你最大有多少种颜色? 思路: 比赛的时候,看到直接手推,发现有点东西,直接打表找出了规律 —— 如果 n的质因子只有一个,那么总数就是 那个 质因子.其它都为 1. 今天上课的时候无聊,还是试着推了一下原理. 1.如果一个数只有一个质因子 x ,那么  n-x .n-2x.n-3x ……等等全为一种颜色,也就是说每隔 x个就是同种颜色,这样的话就是有…
Scheduler Overhaul, with contributions from rbyers, sadrul, rjkroege, sievers, epenner, skyostil, brianderson, jdduke, sievers, nduca, kloba Status: Deprecated. Ideas are valid but priorities and shape have changed Goal Status Two Phase Plan Backgrou…
久违的写篇博客吧 A. Maximum Square 题目链接:https://codeforces.com/contest/1243/problem/A 题意: 给定n个栅栏,对这n个栅栏进行任意排序,问可形成的最大正方形面积是多少 分析: 水题. 先排个序 , 然后暴力枚举正方形边长就可以了 #include<bits/stdc++.h> #define ios std::ios::sync_with_stdio(false) #define sd(n) scanf("%d&qu…
B. Painting The Wall time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output User ainta decided to paint a wall. The wall consists of n2 tiles, that are arranged in an n × n table. Some tiles are p…
WinForms Controls The links below provide comprehensive information on using DevExpress WinForms products. They contain a detailed description of the products API and also provide many examples with step-by-step instructions, screenshot images and so…