⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1156.cpp

📁 acm acmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacmacm
💻 CPP
字号:
#include <iostream>
#include<string>
using namespace std;


int main(void)
{
     int i,j,k,a[100],sum,m,total;
	 char s1[100];

	    while(cin>>m,m)  
		{ 
          sum=total=0;
		  cin>>s1;
	      for(i=0;i<strlen(s1);i++)
		  {
			  a[i]=int(s1[i]-48);
		 	  sum+=a[i];
          }  	
     
	     for( j=0;j<=i-1;j++)
		 {   
		 int product=1;
            for( k=0;k<=j-1;k++)
			{
	      
	         product*=m;
			}
	      total+=a[i-j-1]*product;
		
		 }
	    if(total%sum==0)
	 	cout<<"yes"<<endl;
    	else cout<<"no"<<endl;
	}
	
		return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -