Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
43245 Liyiyang1123 【J】T1 C++ 通过 100 0 MS 264 KB 602 2026-10-28 13:57:19

Tests(10/10):


#include <bits/stdc++.h> #define int long long using namespace std; int n,s; int sum(int x){ int t=x,res=0; while(t>0){ res+=t%10; t/=10; } return res; } bool check(int x){ if(x-sum(x)>=s) return 1; return 0; } signed main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // freopen("num.in","r",stdin); // freopen("num.out","w",stdout); cin>>n>>s; int l=1,r=n; while(l<r){ int mid=(l+r+1)>>1; if(!check(mid)) l=mid; else r=mid-1; } cout<<n-l; return 0; }


测评信息: