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/PTIT004 #720

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Số đơn giản - Luyện Code Online

https://luyencode.net/problem/PTIT004

Conan286 commented 2 years ago

code AC: https://github.com/huykhalac/1000baicpp/blob/main/simple%20number%20ptit.cpp

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 #define ll long long using namespace std; ll tachso(int n){ int sum2 = 0, ans = n; while(n>=10){ int sotachra = 0 , sum = 0; for(;n!=0;){ sotachra=n%10; sum+=sotachra; n/=10; } n=sum; } } int main(){ ll n; cin >> n; cout << tachso(n) << endl; }

wind5293 commented 1 year 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

```cpp #include #define ll long long using namespace std; int nen(ll n) { int tong = 0; while (n > 0){ tong += n % 10; n /= 10; } return tong; } int main() { ll n; cin >> n; while (n / 10 > 0){ n = nen(n); } cout << n; } ```

husofshikamaru commented 1 year ago

Code Java đã accept cho ai cần tham khảo https://pastecode.io/s/b24yoeq8