<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12
      書山有徑勤為路>>>>>>>>

      <<<<<<<<學海無涯苦作舟!

      經典進制轉換——USACO Palindromic Squares

      Description

      Palindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.

      Given a number base B (2 <= B <= 20 base 10), print all the integers N (1 <= N <= 300 base 10) such that the square of N is palindromic when expressed in base B; also print the value of that palindromic square. Use the letters 'A', 'B', and so on to represent the digits 10, 11, and so on.

      Print both the number and its square in base B.

      Input

      A single line with B, the base (specified in base 10).

      Output

      Lines with two integers represented in base B. The first integer is the number whose square is palindromic; the second integer is the square itself.

      Sample Input

      10
      

      Sample Output

      1 1
      2 4
      3 9
      11 121
      22 484
      26 676
      101 10201
      111 12321
      121 14641
      202 40804
      212 44944
      264 69696
      
      
      
      
      
      
      這里簡單說一下base的意思和用法,
      base 10,就是十進制的意思

      #include "iostream"
      #include "string"
      #include "cstring"
      using namespace std;
      int bit[20]={0};
      char chbit[20]={'0'};
      char forbit[20]={'0'};
      int pos, TenBase, pos1;
      
      void ChTen(int base, int num) //將十進制的數 轉化成相應的進制 數組形式的
      {
      	int i;
      	for(i=0; num>0; i++)
      	{
      		bit[i] = num%base;
      		num /= base;		
      	}
      	pos = i-1; //統計字符串長度
      }
      
      bool Judge() //判斷字符數組是否為回文
      {
      	pos1 = pos;
      	for(int i=0; i<=pos; i++)
      	{
      		if(bit[i]<10)
      			chbit[i] = bit[i]+48;
      		else
      			chbit[i] = bit[i] - 10 + 'A';
      	}
      	for(int i=0, j=pos1; i<=j; i++, j--)
      		if(chbit[i]!=chbit[j])
      			return false;
      	return true;
      }
      int main()
      {
      	int base, TenNum;
      	cin>>base;
      	for(int m=1; m<=300; m++)
      	{
      		TenNum = m*m;
      		ChTen(base, TenNum);
      		if(Judge())
      		{
      			ChTen(base, m);
      			for(int i=0; i<=pos; i++)
      			{
      				if(bit[i]<10)
      					forbit[i] = bit[i]+48;
      				else
      					forbit[i] = bit[i] - 10 + 'A';
      			}
      			for(int i=pos; i>=0; i--)
      				cout<<forbit[i];
      			cout<<" ";
      			for(int i=pos1; i>=0; i--)
      				cout<<chbit[i];
      			cout<<endl;
      		}
      	}
      }

      posted on 2011-10-16 11:00  More study needed.  閱讀(252)  評論(0)    收藏  舉報

      導航

      書山有徑勤為路>>>>>>>>

      <<<<<<<<學海無涯苦作舟!

      主站蜘蛛池模板: 精品国产性色av网站| 99精品国产综合久久久久五月天| 欧美孕妇乳喷奶水在线观看| 西昌市| 玩弄放荡人妻少妇系列| 国内极度色诱视频网站| 国产乱人伦av在线无码| 亚洲自拍偷拍一区二区三区| 91麻豆视频国产一区二区| 亚洲AV无码久久精品成人| 九九在线精品国产| 亚洲码国产精品高潮在线| 国产成人无码AV大片大片在线观看| 熟女系列丰满熟妇AV| 国99久9在线 | 免费| 亚洲AV无码国产在丝袜APP| 久久蜜臀av一区三区| 成人综合人人爽一区二区| 亚洲乱码一二三四区| 色欲国产精品一区成人精品| 精品乱码一区内射人妻无码| 亚洲熟女乱综合一区二区| 亚洲精品777| 国产成人精品2021欧美日韩| 精品国产精品午夜福利| 日韩有码中文字幕av| 日韩精品卡1卡2日韩在线| 男女啪祼交视频| 久99久热精品免费视频| 无码伊人久久大杳蕉中文无码| 国产精品人妻中文字幕| 日韩人妻av一区二区三区| 亚洲午夜精品久久久久久浪潮| 久久综合色一综合色88| 色伦专区97中文字幕| 亚洲第一成人网站| 日韩福利片午夜免费观着| 97人妻中文字幕总站| 性姿势真人免费视频放| 奇米四色7777中文字幕| 久久精品一本到99热免费|