Open utterances-bot opened 2 years ago
https://luyencode.net/problem/SPPH
Đâ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 using namespace std; #define ll long long const int x = 100005; ll s[x + 10]; ll l, r, ans; int main(){ for(ll i = 1; i * 2 <= x; i++){ for(ll j = i * 2; j <= x; j += i){ s[j] = s[j] + i; } } cin >> l >> r; for(ll i = l; i <= r; i++){ if(s[i] > i) ans++; } cout << ans; return 0; }
SỐ PHONG PHÚ - Luyện Code Online
https://luyencode.net/problem/SPPH