Problem ID :z096. 提款卡密碼(讀一筆資料)

New Thread

User 不知道要怎麼改~

alex0301 SendIMessage
alex

z096. 提款卡密碼(讀一筆資料) | From: 211.22.52.6 | Post Date:2020-05-13 17:21:55.0

#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main () {
string a;
int x,y,b[7],c;
cin>>a;
c=a.size();
for(y=0;y<c;y++) {
if(abs(a[y]-a[y+1])>10) {
if(abs(a[y]-a[y+1])>20) {
b[y]=abs(a[y]-a[y+1])%20;
}
else b[y]=abs(a[y]-a[y+1])%10;
}
}
for(y=0;y<c;y++) {
cout<<b[y];
}
return 0;
}
 


文章類型: 一般 | Reply | Back

New Thread

ZeroJudge Forum