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

📄 974 kaprekar numbers.cpp

📁 UVA solutions to few problems
💻 CPP
字号:
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
    int test,count=1;
    int arr[]={9,45,55,99,297,703,999,2223,2728,4879,4950,5050,5292,7272,7777,9999,17344,22222,38962};
    int k[20];
    int a,b;
    cin>>test;
    while(test--)
    {
                 cin>>a>>b;
                 int i=0,j=0,end;
                 int t=0;
                 for(i=a;i<=b;i++)
                 {
                         for(j=0;j<19;j++)
                         {
                                 if(arr[j]==i)
                                 {
                                              k[t]=arr[j];
                                              t++;
                                 }
                         }
                 }
                 if(t!=0)
                 {
                         end=t;
                         cout<<"case #"<<count<<endl;
                         for(t=0;t<end;t++)
                         cout<<k[t]<<endl;
                         if(test!=0)
                         cout<<endl;
                 }
                 else
                 {
                     cout<<"case #"<<count<<endl;
                     cout<<"no kaprekar numbers"<<endl;
                     if(test!=0)
                     cout<<endl;
                 }
    count++;
    }
    system("pause");
}
                                              
                         
                 

⌨️ 快捷键说明

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