• LQDOJ
  • Trang chủ
  • Bài tập
  • Bài nộp
  • Thành viên
  • Kỳ thi
  • Nhóm
  • Giới thiệu
    • Máy chấm
    • Khóa học
    • Đề xuất ý tưởng
    • Đề xuất bài tập
    • Tools
    • Báo cáo tiêu cực
    • Báo cáo lỗi

Tiếng Việt

Tiếng Việt
English

Đăng nhập

Đăng ký

vuthihien01011982

  • Giới thiệu
  • Bài tập
  • Bài nộp

Rating
-
Bài tập
25
Điểm
12217
Rating #
-
Điểm #
4232

Giới thiệu

include<bits/stdc++.h>

using namespace std;
string st;
long long xuly1(char x,int k)
{
string xau="";
while(k--)
xau+=char(x+1);
return stoll(xau);
}
long long xuly2(char x,int k)
{
string xau="";
while(k--)
xau+=x;
return stoll(xau);
}
int xuly3(char x,int k)
{
string xau;
if(x<'9')
{
xau="";
while(k--)
xau+=char(x+1);
}else
{
xau="1";
while(k--)
xau+='1';
}
return stoll(xau);
}
int main()
{
cin>>st;
for(int i=1;i<st.length();i++) { if(st[i]>st[0]){cout<<xuly1(st[0],st.length())-stoll(st);return 0;}
if(st[i]<st[0]){cout<<xuly2(st[0],st.length())-stoll(st);return 0;}
}
cout<<xuly3(st[0],st.length())-stoll(st);
return 0;
}


«    »
Thứ 2
Thứ 3
Thứ 4
Thứ 5
Thứ 6
Thứ 7
CN
Ít
Nhiều

proudly powered by DMOJ| developed by LQDJudge team