#29582:


e3524167 (Kenlogin)

學校 : 不指定學校
編號 : 186743
來源 : [182.233.207.92]
最後登入時間 :
2022-03-17 21:12:56
a054. 電話客服中心 -- 板橋高中教學題 | From: [182.233.207.92] | 發表日期 : 2022-03-12 23:59

#include <iostream>

#include <string> 

#include <sstream>

using namespace std;

int main()

{

string list[26] = {"10", "11", "12", "13", "14", "15", "16", "17", "34", "18", "19", "20", "21",

"22", "35", "23", "24", "25", "26", "27", "28", "29", "32", "30", "31", "33" };

 

string list2[26] = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R",

"S","T","U","V","W","X","Y","Z" };

string x;

while (cin >> x)

{

stringstream temp;

stringstream temp2;

int res,a,b=0;

string str;

int a1, a2,orgin;

for (int i = 0; i < x.length(); i++)

{

temp << x[i];

temp >> res;

a = res * (x.length() - i-1);

b = b + a;

temp.str("");

temp.clear();

}

//b = 10 - (b % 10);

for (int i = 0; i < 26; i++)

{

string str2;

orgin = b;

str = list[i];

str2 = list[i];

temp << str[0];

temp2 << str[1];

temp >> a1;

temp2 >> a2;

temp.str("");

temp.clear();

temp2.str("");

temp2.clear();

orgin = 10 - (orgin + a1 + a2*9) % 10;

temp << x[x.length() - 1];

temp >> str;

if (orgin == 10)

{

orgin = 0;

}

if (str == to_string(orgin))

{

cout << list2[i];

}

temp.str("");

temp.clear();

}

//cout << b << endl;

}

}

 
ZeroJudge Forum