Problem hidden
|This problem was hidden by Editorial Board member probably because it has incorrect language|version or invalid test data, or description of the problem is not clear.|

RGB7371 - Армстронгийн тоо


Тооны цифр тус бүрийг оронгийнх нь тоогоор зэрэгт дэвшүүлж нэмэнхэд гарсан тоо нь уг тоотойгоо тэнцүү байвал уг Армстрогийн тоо гэнэ.   Өгөгдсөн тоо Армстронгийн тоо бол YES, үгүй бол NO гэж хэвлэ.

Input

Бүхэл тоо өгөгдөнө. Int төрөл.

Output

Мөн бол YES, үгүй бол NO гэж хэвлэнэ.

Example

Input:
371

Output:
YES
Тайлбар : 153 тоо нь 3 оронтой тоо тул 1, 5, 3 цифр тус бүрийг нь 3 зэрэгт дэвшүүлж нэмбэл 1+125+27 буюу 153 болно. 
Иймд уг тоо нь Армстронгийн тоо болох тул YES гэж хэвлэнэ.

Нэмсэн:Bataa
Огноо:2013-03-21
Хугацааны хязгаарлалт:1s
Эх кодын хэмжээний хязгаарлалт:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Програмчлалын хэлүүд:ADA95 ASM32 BASH BF C NCSHARP CSHARP C++ 4.3.2 CPP C99 CLPS LISP sbcl LISP clisp D ERL FORTRAN HASK ICON ICK JAVA JS-RHINO JULIA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON PYPY3 PYTHON3 RUBY SCALA SCM guile ST TCL WHITESPACE

hide comments
2024-05-04 06:49:25
#include <bits/stdc++.h>
using namespace std;
int main (){
int a,s=0,l,b,sum = 0;
cin >> a;
l=a;
int k = a;
while (a!=0){
a=a/10;
s++;
}
while(l!=0){
b = l % 10;
sum = sum + pow(b,s);
l = l / 10;
}
if(sum == k){
cout << "YES";
}
else{
cout << "NO";
}
}
2023-12-06 03:36:11
using namespace std;
#include <iostream>
#include <cmath>

int la(int k){
int ans=0;

while(k%10>0){
ans++;
k=k/10;
}
return ans;
}
int sum(int k, int d){
int ans=0;

while(k%10>0){
ans=ans+pow(k%10,d);
k=k/10;
}
return ans;
}

int main() {
int n, l;
cin>>n;
l=la(n);
if(sum(n,l)==n){
cout<<"YES";
}else cout<<"NO";



return 0;
}

3 daraaallllaaaaaaa
2023-12-04 09:44:01
call me


Last edit: 2023-12-04 09:44:32
2023-12-04 09:43:48
#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a[100],i,j=0,n,k=0,s=0;
cin>>n;
int glg=n;
int w;
w=n;
while(n>0){
n=n/10;
s++;
}
int q;
while(j<s){
j++;
q=w%10;
w=w/10;
a[j]=q;
}
for(i=1; i<=s; i++){
k+= pow(a[i] , s);
}
if(k==glg){
cout<<"YES";
}
else{
cout<<"NO";
}
return 0;
}
//Saihna desuyo
2023-12-03 08:14:22
#include <iostream>
#include <cmath>
#include <string>
using namespace std;

int main() {
string n;
int s = 0;
cin >> n;

for (char too : n) {
int tooValue = too - '0';
s = s + pow(tooValue, n.size());
}

int m = stoi(n);

if (m == s) {
cout << "YES";
} else {
cout << "NO";
}

return 0;
}
deelii bla
2022-07-01 18:49:32
#include<bits/stdc++.h>
using namespace std;
int main()
{
int x,b,c=0,d=0,u;
cin>>x;
u=x;
while(x>0) {
d++;
x/=10;
}
x=u;
while(x>0) {
b=x%10;
c+=pow(b,d);
x/=10;
}
if(c==u)
cout<<"YES";
else
cout<<"NO";
}
2021-11-10 10:57:12
uunuu gang2
2021-11-08 10:11:52
shaahguyu deer ni tahia sheehguyu
2021-11-08 10:11:29
uunuu hard2
2019-11-16 06:43:51
ugaasaa tiin sh dee hoshnogo min
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.