Educational Codeforces Round 7、
A - Infinite Sequence
题意:有一种这样的无限序列数 1,1,2,1,2,3..... (如果最大数n,那么就有从1到n的所有1到n的数);
思路:题意只给了1秒、直接模拟肯定超时,我用的是二分找下界
#include<iostream>
using namespace std;
long long f(long long x)
{
return (+x)*x/;
}
long long search(long long x)
{
int l,r,m;
l=;r=1e8;
while(l<=r){
m=(l+r)/;
if(f(m)>=x) r=m-;
else l=m+;
}
return l;
}
int main()
{
long long n;
while(cin >> n){
long long ans;
ans=search(n);
ans=n-f(ans-);
cout << ans << endl;
}
}
#include<stdio.h>
int main()
{
long long int n,i,k;
scanf("%lld",&n);
i=;
k=n;
while(k>i)
{
k-=i;
i++;
}
printf("%lld",k);
return ;
}
B - The Time
题意:给一个时间给你,然后给你个分钟时间给你,让你相加
思路:直接模拟算
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int a,b;
while(~scanf("%d%*c%d%*c",&a,&b)){
int c;scanf("%d",&c);
int ans=c/;
int cns=c%;
ans+=(cns+b)/;
ans+=a;
cns=(cns+b)%;
ans=ans%;
printf("%02d:%02d\n",ans,cns);
}
}
Educational Codeforces Round 7、的更多相关文章
- Educational Codeforces Round 11、A B题
A. Co-prime Array 题意:给你一个数列,要求构造两两相邻之间的数互质的数列,可以插入的数的小于10的9次方 思路:其实可以选择靠近10的9次方的最大的三个素数.然后按我下面的方法做就可 ...
- Educational Codeforces Round 35 (Rated for Div. 2)
Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...
- Educational Codeforces Round 63 (Rated for Div. 2) 题解
Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...
- Educational Codeforces Round 58 (Rated for Div. 2) 题解
Educational Codeforces Round 58 (Rated for Div. 2) 题目总链接:https://codeforces.com/contest/1101 A. Min ...
- Educational Codeforces Round 40千名记
人生第二场codeforces.然而遇上了Education场这种东西 Educational Codeforces Round 40 下午先在家里睡了波觉,起来离开场还有10分钟. 但是突然想起来还 ...
- Educational Codeforces Round 69 (Rated for Div. 2) E. Culture Code
Educational Codeforces Round 69 (Rated for Div. 2) E. Culture Code 题目链接 题意: 给出\(n\)个俄罗斯套娃,每个套娃都有一个\( ...
- Educational Codeforces Round 65 (Rated for Div. 2)题解
Educational Codeforces Round 65 (Rated for Div. 2)题解 题目链接 A. Telephone Number 水题,代码如下: Code #include ...
- Educational Codeforces Round 64 (Rated for Div. 2)题解
Educational Codeforces Round 64 (Rated for Div. 2)题解 题目链接 A. Inscribed Figures 水题,但是坑了很多人.需要注意以下就是正方 ...
- Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块
Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ...
随机推荐
- opencv 图像基本操作
目录:读取图像,获取属性信息,图像ROI,图像通道的拆分和合并 1. 读取图像 像素值返回:直接使用坐标即可获得, 修改像素值:直接通过坐标进行赋值 能用矩阵操作,便用,使用numpy中的array ...
- Watering Grass (贪心,最小覆盖)
参考: https://blog.csdn.net/shuangde800/article/details/7828675 https://www.cnblogs.com/haoabcd2010/p/ ...
- Keil新建工程步骤
第一步:创建工程文件夹 1.新建一个文件夹,例如: 2.在文件夹下创建子文件夹: 文件夹说明: App:存放硬件控制程序: Libraries:存放固件库: Obj:存放生成的文件: Public:存 ...
- 超火js库: Lodash API例子
lodash.js是一款超火的js库,在npm上平均周下载量达到了惊人的12,374,096,github start36K!大量框架都用到了lodash,包括拥有123kstart的vue 本文对比 ...
- tablespaces
select * from user_tablespaces; select username,default_tablespace from user_users;
- PHPCMS快速建站系列之pc:get标签的应用
GET标签使用方式如下: {pc:get sql="SELECT * FROM phpcms_member" cache="3600" page="$ ...
- 安装vagrant&virtualBox
https://blog.csdn.net/dream_188810/article/details/78218073 VirtualBox是一款开源免费的虚拟机软件(之前一直使用vm,vm功能较多, ...
- hdu2149 巴什博奕
n表示先手胜 p表示先手负 1~N N+1 N+2~2*N+1 2*N+2 2*N+3~3*N+2 ... n p n p n ... m总归个数 每次取1~N个根据前面的规律得到,如果m/N==m% ...
- BZOJ 4034 洛谷3178 树上操作题解
一个很裸的树链剖分模板.注意一下数据范围,有的地方要开longlong,这就是唯一的陷阱了. # include<iostream> # include<cstdio> # i ...
- React Native错误汇总(持续更新)
错误1 Element type is invalid-: 错误描述: Element type is invalid: expected a String(for built-in componen ...