標籤
- C
- android
- Objective-c
- Sort
- BlueTooth
- Python
- 133
- Apache
- ArrayList
- BluetoothChat
- C sharp
- C#
- CVS
- CheckBox
- Closest Pair
- Console.ReadLine
- HashMap
- NFC
- NSDocumentDirectory
- NSString
- Pandaboard
- SQLite
- UIAlertController
- VB
- Xcode6
- driver
- execSQL
- gatt error
- httpd.conf
- office
- primie check
- property
- sharedApplication
- 小小問題
2015年9月17日 星期四
C int mapping string
Encoding scheme defined by the following mapping:
1->'A',
2->'B',
3->'C',
...,
9->'I',
0->'J'.
Input A three-digit integer N
Output The encoding result
int main(void) {
char dict[10] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'I', 'J'};
int i;
while(EOF != scanf("%d", &i)) {
if (100 <= i && i <= 999) {
char data[3];
data[0] = dict[i/100-1];
i = i%100;
data[1] = dict[i/10-1];
i = i%10;
data[2] = dict[i-1];
printf("%s\n", data);
}
}
return 0;
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言