谜之WA
2024-10-07 13:06:37
谜之WA
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll k,n;
ll res=;
ll check()
{
ll ans=;
ll t=1ll;
ll b=k-;
while((t*k-)/b<n)t*=k,ans++;
// if(t*k<0)puts(0);
res=n-(t-)/b;
if(res==)
{
res=;
return ans;
}
if(res>t/k)res=;
else res=;
return ans;
}
int main()
{
ll t;
cin>>t;
while(t--)
{
res=;
cin>>k>>n; //else
if(k==)cout<<n-<<'\n';
//else if(k>1000000000)puts(0);
else
{
ll x=check();
if(res)cout<<x+x<<'\n';
else cout<<x+(x-)<<'\n';
}
}
}
AC:
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll k,n;
ll res=;
ll check()
{
ll ans=;
ll t=; while(t<n)n-=t,t*=k,ans++;
//ll a=1; // if(t*k<0)puts(0);
res=n;
//cout<<res<<'\n';
if(res==)
{
res=;
return ans-;
}
if(res>t/k)res=;
else res=;
return ans;
}
int main()
{
ll t;
cin>>t;
while(t--)
{
res=;
cin>>k>>n; //else
if(k==)cout<<n-<<'\n';
//else if(k>1000000000)puts(0);
else
{
ll x=check();
if(res)cout<<x+x<<'\n';
else cout<<x+(x-)<<'\n';
}
}
}
最新文章
- 基於tiny4412的Linux內核移植--- 中斷和GPIO學習(1)
- Mac 开发者常用的工具
- easyui 中重复加载两次url
- 在MyEclipse上搭建web服务器
- 安装wampserver出现“The Program can&#39;t start because MSVCR110.dll is missing from your computer. Try reinstalling the program to fix this problem”
- python time 模块详解
- 转:推荐!国外程序员整理的 C++ 资源大全
- Java过滤器Filter使用详解
- Django 系列博客(十一)
- selenium测瀑布流UI页面的Python代码
- Coffee and Coursework (Easy version)
- c# 遍历类中的方法名称
- ViewDragHelper
- Xshell中vim退出内容仍停留在屏幕的问题
- vue版本冲突解决办法
- VS Code 中文注释显示乱码 解决方法
- C和指针第七章第五题
- 接触mybatis使用
- texlive2018和texstudio的安装及汉化教程
- centos7最小化安装后配置笔记
热门文章
- React-onsenui之RouterNavigator组件解读
- java 泛型深入
- Web高级 JavaScript中的数据结构
- 2019寒假作业二:PTA7-1币值转换
- 【sql server复制】不重新初始化快照的情况下新增表/存储过程/函数等
- 对第一个HelloWorld程序的总结:
- 使用内核LED框架搭建驱动 ——led_classdev_register
- [常用类]String 类
- IETester——用来测试IE5.5~IE11兼容性的工具
- uve (mui/light7)写APP的使用心得(大坑);