Open utterances-bot opened 1 year ago
https://oj.luyencode.net/problem/BEAUTIFUL
Đây là lời giải của mình đã AC. Nếu bạn đã cố gắng mà chưa làm được thì có thể tham khảo lời giải của mình.
#include #define ll long long using namespace std; int reversed(ll n){ ll sotachra = 0, sum = 0; for(;n!=0;){ sotachra=n%10; sum=(sum*10)+sotachra; n/=10; } return sum; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ll a, b, c; cin >> a >> b >> c; ll cnt = 0; for(ll i=a;i<=b;i++){ if(abs(i-reversed(i))%c==0){ cnt++; } } cout << cnt << endl; }
Đảo ngược số - Luyện Code Online
https://oj.luyencode.net/problem/BEAUTIFUL