摘要:
C. Helping the Nature time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Little Leon lives 阅读全文
摘要:
比较难,没怎么看懂 //约数: //如果一个数d是n的一个约数,即d能整除n,那么n/d也能整除n: //求所有约数(除法求约数,o(sqrt(n))) #include<bits/stdc++.h> using namespace std; const int N=1e5+10; int n,x; 阅读全文
摘要:
给出一个长为n的只由'1','2','0'组成的字符串,要求改动最少的位置,使'1','2','0'的个数相同(保证n能被3整除),并使改动后的字符串字典序最小。 n不大于3∗105 贪心思路,从左向右大的变小的,从右向左小的变大的: #include<bits/stdc++.h> using na 阅读全文
摘要:
B. Pasha Maximizes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Pasha has a positive i 阅读全文
摘要:
题目描述 给定一个长度为 N 的数列,1,2,⋯A1,A2,⋯AN,如果其中一段连续的子序列 ,+1,⋯(≤)Ai,Ai+1,⋯Aj(i≤j) 之和是 K 的倍数,我们就称这个区间 [,][i,j] 是 K 倍区间。 你能求出数列中总共有多少个 K 倍区间吗? 输入格式 第一行包含两个整 阅读全文