luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/DIVISIBLE #819

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Số đẹp 3 - Luyện Code Online

https://oj.luyencode.net/problem/DIVISIBLE

nmihtrug commented 2 years ago

AC c++ cho mng nha!!!

Xem code AC

``` #include using namespace std; int t; long long l, r; int countDiv(int x) { return (r / x) - ((l - 1) / x); } int main() { ios_base::sync_with_stdio(false); cin >> t; while (t--) { cin >> l >> r; long long res = countDiv(4) + countDiv(7) + countDiv(11) - countDiv(28) - countDiv(44) - countDiv(77) + countDiv(308); if (l == 0) res++; cout << res << '\n'; } return 0; } ```

nmihtrug commented 2 years ago

sửa lai xíu nha :)))

Xem code AC

``` #include using namespace std; typedef long long ll; int t; ll l, r; ll countDiv(int x) { return (r / x) - ((l - 1) / x); } int main() { ios_base::sync_with_stdio(false); cin >> t; while (t--) { cin >> l >> r; ll res = countDiv(4) + countDiv(7) + countDiv(11) - countDiv(28) - countDiv(44) - countDiv(77) + countDiv(308); if (l == 0) res++; cout << res << '\n'; } return 0; } ```

sseu18042004 commented 1 year ago

code co giai thich. Chúc mn một ngày vui vẻ

Xem code AC

#include #define ll long long int #define ull unsigned long long int #define llb long double #define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define el cout<<"\n" using namespace std; int main() { int t; cin>>t; while(t--) { ll l,r; cin>>l>>r; ll res=r/4+r/7+r/11; ll tmp; tmp=r/(4*7); res-=tmp; tmp=r/(4*11); res-=tmp; if (tmp>=7) res+=tmp/7; res-=r/(7*11); res+=1; //cout<=7) res1+=tmp/7; res1-=l/(7*11); res1+=1; cout<