| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 74132 | 李言 | 位运算 | C++ | Accepted | 100 | 0 MS | 248 KB | 321 | 2023-05-20 17:15:50 |
#include<bits/stdc++.h> using namespace std; int k,n,ans; int check(int x){ int s=0; while(x){ s+=x%10; x/=10; } return s; } int main(){ cin>>n; k=check(n); if(k==1){ cout<<0; return 0; } for(int i=n-1;i>=0;i--){ if(check(i)==k-1){ cout<<i; return 0; } } return 0; }