---
# System prepended metadata

title: 基礎 (7題)

---

# 10101 Bangla Numbers

## 

# 10929 - You can say 11

## Code

```cpp=
#include <bits/stdc++.h> 
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string N;
    while (cin >> N)
    {
    	if (N == "0")
    	    break;
    		
    	int odd = 0, even = 0;
    	
    	for (int i = 0; i < (int)N.size(); i++)
    	{
    	    if (i % 2 == 1)
    	        odd += N[i] - '0';
    	    else
    	        even += N[i] - '0';
    	}
    	
    	if ((odd - even) % 11 == 0)
    	    cout << N << " is a multiple of 11.\n";
    	else
    	    cout << N << " is not a multiple of 11.\n";
    }

    return 0;
}
```

## I/O

```
112233
30800
2937
323455693
5038297
112234
0011
00011
030800
```

```
112233 is a multiple of 11.
30800 is a multiple of 11.
2937 is a multiple of 11.
323455693 is a multiple of 11.
5038297 is a multiple of 11.
112234 is not a multiple of 11.
0011 is a multiple of 11.
00011 is a multiple of 11.
030800 is a multiple of 11.
```

# 10222 - Decode the bad man

```cpp=
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int main()
{
    string s = "`1234567890-=qwertyuiop[]\\asdfghjkl;'zxcvbnm,./";
    char c;
    
//  int T;
//  while (cin >> T)
//  {
//      cin.ignore();
        while (cin.get(c))  
    `   {
            c = tolower(c);
	    	
            if (c == ' ' || c == '\n')  cout << c;
            else
            {
                // 在字串中找這個字元
                for (int i = 2; i < s.length(); i++)
                {
                    if (s[i] == c)
                    {    
                        cout << s[i-2]; 
                        break;
                    } 
                }
            }    
        }
//  }
    return 0;
}
```

:::warning
### CPE 2021-10-19 P2

官方有修改此題目：你必須先輸入「測資數量」，然後讀取每一行。

- 移除上述程式碼的 `//` 符號運行程式
- [CPE 官方 - 範例程式碼uva10222](https://cpe.mcu.edu.tw/cpe/problemPdf/10222.php)
:::