101年正式題第3題-子題2-編碼
題目大意:讀入一串只有0、1的字串,由下列編碼表找出對應的字元
二進制
字元
二進制
字元
00
A
11100
4
01
B
11101
5
100
0
111100
6
101
1
111101
7
1100
2
111110
8
1101
3
111111
9
輸入檔(in.txt)
6
1111001111011111101111111000010001
101110011101110111000010101
11100110111001011110001
111011100110111100110100
1011100100111111110000
1011100110111100110001
...
2015年12月31日 星期四
2015年10月23日 星期五
2015年8月26日 星期三
C++進階研習: a010因數分解
// zerojudge.tw 的 a010 質因數分解
// 建質數表較費事,若資料不多不一定要建表,像a007有十萬筆就一定要建表
#include <iostream>
#include <cstring>
#include <vector>
#include <cmath>
#define maxn 46340 // sqrt(2147483647) < 46341
using namespace std;
bool c[maxn+10]; //0~46340之間false為質數
vector <int> p; // 2~46340之間的質數共有 4792個
// p[4791]=46337 , p[4790]=46327,p[4792]=46349
//...