[题解]Print a 1337-string...-数学(codeforces 1202D)
题目链接:https://codeforces.com/problemset/problem/1202/D

题意:
构造一串只由 ‘1’,‘3’,‘7’ 组成的字符串,使其 ‘1337’ 子序列数量为n
思路:
构造 ‘13377733337’ 类型的字符串,使 C(m,2)+k=n
k为中间 ‘7’ 的数量,C(m,2)为中间 ‘3’ 的数量
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,m,n) for(int i=m;i<n;i++)
const int N = 2e5+;
ll a[],b[]; int main(){
ios::sync_with_stdio(false);
cin.tie();
cout.tie();
int t,n;
cin>>t;
while(t--){
cin>>n;
int num=sqrt(n*),x,y;
rep(i,num,*n+){
if(i*(i-)<=*n)
x=i,y=n-i*(i-)/;
else
break;
}
cout<<"";
rep(i,,y)
cout<<"";
rep(i,,x-)
cout<<"";
cout<<""<<endl;
}
return ;
}
[题解]Print a 1337-string...-数学(codeforces 1202D)的更多相关文章
- iOS开发调试篇—Print Description of "string"
Print Description of "string":把 string 的信息输出到控制台.Copy:复制 string 的信息,包含变量名,类名和值.View Value ...
- 【CodeForces】708 B. Recover the String 数学构造
[题目]B. Recover the String [题意]找到一个串s,满足其中子序列{0,0}{0,1}{1,0}{1,1}的数量分别满足给定的数a1~a4,或判断不存在.数字<=10^9, ...
- Codeforces 1204D Kirk and a Binary String - 数学
题目传送门 传送门 群除我均会猜结论/找规律,sad.... 以下内容只保证代码能过system test,证明应该都是在纯口胡 约定下文中的$LIS$表示最长不下降子序列. 定义$zero(s)$表 ...
- Codeforces - 1202D - Print a 1337-string... - 构造
https://codeforces.com/contest/1202/problem/D 当时想的构造是中间两个3,然后前后的1和7组合出n,问题就是n假如是有一个比较大的质数因子或者它本身就是质数 ...
- 贪心/数学 Codeforces Round #212 (Div. 2) A. Two Semiknights Meet
题目传送门 /* 贪心/数学:还以为是BFS,其实x1 + 4 * k = x2, y1 + 4 * l = y2 */ #include <cstdio> #include <al ...
- 数学 Codeforces Round #308 (Div. 2) B. Vanya and Books
题目传送门 /* 水题:求总数字个数,开long long竟然莫名其妙WA了几次,也没改啥又对了:) */ #include <cstdio> #include <iostream& ...
- 数学 Codeforces Round #219 (Div. 2) B. Making Sequences is Fun
题目传送门 /* 数学:这题一直WA在13组上,看了数据才知道是计算cost时超long long了 另外不足一个区间的直接计算个数就可以了 */ #include <cstdio> #i ...
- n=C(2,n)+k(构造)( Print a 1337-string)Educational Codeforces Round 70 (Rated for Div. 2)
题目链接:https://codeforc.es/contest/1202/problem/D 题意: 给你一个数 n ( <=1e9 ),让你构造137713713.....(只含有1,3,7 ...
- 数学 Codeforces Round #291 (Div. 2) B. Han Solo and Lazer Gun
题目传送门 /* 水题,就是用三点共线的式子来判断射击次数 */ #include <cstdio> #include <cmath> #include <string& ...
随机推荐
- poj2385 Apple Catching (线性dp)
题目传送门 Apple Catching Apple Catching Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 154 ...
- 73.Largest Rectangle in Histogram(最大矩形)
Level: Hard 题目描述: Given n non-negative integers representing the histogram's bar height where the ...
- linux性能分析工具Ntop
- regex - POSIX 1003.2 正则表达式
DESCRIPTION 正则表达式 (``RE''s), 在 POSIX 1003.2 中定义,包含两种类型:新式 REs (基本上指的是 egrep 使用的那些,1003.2 称其为 ``exten ...
- Codeforces Round #393 (Div. 2) - B
题目链接:http://codeforces.com/contest/760/problem/B 题意:给定n张床,m个枕头,然后给定某个特定的人(n个人中的其中一个)他睡第k张床,问这个人最多可以拿 ...
- python数字图像处理(五) 图像的退化和复原
import cv2 import numpy as np import matplotlib.pyplot as plt import scipy import scipy.stats %matpl ...
- spring中引入多个quertz 注意事项
每一个独立的调取任务 需起不同的名字,否则只有最后一个调度起作用其他不起作用
- Flutter-Text
text的主要属性有:textAlign,maxLines,overflow等. Text( "hello flutter!", TextAlign:TextAlign.cente ...
- poj 2186: Popular Cows(tarjan基础题)
题目链接 tarjan参考博客 题意:求在图上可以被所有点到达的点的数量. 首先通过tarjan缩点,将所有内部两两可达的子图缩为一点,新图即为一个有向无环图(即DAG). 在这个DAG上,若存在不止 ...
- 【leetcode】1020. Partition Array Into Three Parts With Equal Sum
题目如下: Given an array A of integers, return true if and only if we can partition the array into three ...