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/contest/26/problem/B2_GANHH #472

Open utterances-bot opened 3 years ago

utterances-bot commented 3 years ago

Apok's Second Contest - Luyện Code Online

https://luyencode.net/contest/26/problem/B2_GANHH

vuthanhtu commented 3 years ago

liệu 1 có phải số hoàn hảo không ?? 1<2*1 mà :v

ApokPhuoc commented 3 years ago

à em quên ko lưu ý là : số 1 không phải số hoàn hảo

tuankietcoderr commented 3 years ago

hầu hết các test đều có số 1

HaoPham23 commented 3 years ago

đề bài bị lỗi 1 tí nhé, phải là "nhỏ hơn" chứ ko phải "ko lớn hơn" 2 lần số đó.

goiliace commented 3 years ago

bậc thầy cày trâu, ông vua ngành trồng lúa :))

chatctt commented 2 years ago

Đâ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.

Xem code AC

#include #include #include using namespace std; int kt(int n) { if(n==1) return 0; int s=0; for(int i=1;i<=sqrt(n);i++) { if(n%i==0) { if(i*i!=n) { s+=i+n/i; } else { s+=i; } } } if(s<2*n) return 1; else return 0; } int main() { int n,a[100000]; cin>>n; int dem=0; for(int i=1;i<=n;i++) cin>>a[i]; for(int i=1;i<=n;i++) { if(kt(a[i])==1) dem++; } cout<

danh2006 commented 2 years ago

Đâ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.

Xem code AC

#include #include using namespace std; int check(int n){ int sum = 0; if(n==1){ return false; } for(int i=1;i<=sqrt(n);i++){ if(n%i==0){ if(i!=n/i){ sum+=i+n/i; }else{ sum+=i; } } } if(sum<2*n) return true; else return false; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; int a[n]; for(int i=0;i> a[i]; } int res = 0; for(int i=0;i