我本來想對 B
二分搜,然後反推 H2
,之後計算出其它項…
我也真的這麼做了,跑去推 Hi
的通式,但發現
Hi
的通式中含有 (1 + sqrt(8)) ^ i
這種東西…這根本不能用啊
這題不太容易看出來是二分搜…倒是更讓人想到利用 xor。這題另一個難點是 IO ,
據說卡 cin/cout
,還有這題的題目也不易讀懂啊。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
這本來的某考上大學的非資訊社同學問我的,剛好有空就把它整理出來 | |
以下是一些我臨時想到的,歡迎補充。 | |
這些對論壇中大部人已經是基礎了吧~不過我想對下一屆學弟還是有用的。 | |
我自己是習慣用 cin 和 string 來做 input,雖然有些題目真的需要用 scanf 速度上才過得了… | |
但 scanf 跟我不是很熟,怕誤導學弟,就等其它人來寫了。 | |
以下都以例子來說明。 | |
註:這些寫法不是唯一的,存在著許多不同寫法可以有同樣效果。 | |
目錄: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <algorithm> | |
#include <vector> | |
#include <cstring> | |
#include <iomanip> | |
using namespace std; | |
int build_num(const string s, int* map) { | |
if (s.length() == 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Yu-Cheng Huang 09.24.2014 403410034 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
int max(const int a, const int b) { | |
return ((a > b) ? a : b); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <time.h> | |
#include <string.h> | |
#include <getopt.h> | |
#include <stdbool.h> | |
int int_data[1000000]; | |
char* str_data[1000000]; | |
void* temp[1000000]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
我想應該很多人寫 uva 時會遇到很多問題,所以我就寫了些教學。 | |
這只是較常見的輸入型式,還存在其它複雜許多的,但大一應該碰不到,我就不一一論述了,有遇到問題的可以問我。 | |
目錄: | |
0. uva 講解。 | |
1. 單筆測資 | |
2. 有給定測資數 | |
3. 多筆測資:單行 | |
4. 多筆測資:多行 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
要求: | |
單筆測資,輸入為一個正整數(保證 int 可存),請輸出這個整數出現次數 2 次以上的數字,並輸出出現的次數。 | |
若沒有任何數字出現 2 次以上,請輸出 "No repeated digit"。 | |
# Sample Input 1 | |
233345 | |
# Sample Output 1 | |
3: 3 | |
# Sample Input 2 | |
12345 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
上個教學中使用 flag 的那種技巧是非常非常頻繁地使用的,以下舉幾個簡單例子。 | |
*/ | |
/* | |
題目 1: | |
單筆測資,給你一個長度為 10 的序列,序列中的每一項都是正整數(保證 int 可存),請輸出序列中的最大值。 | |
# Sample Input | |
6 5 4 8 9 3 2 1 7 0 | |
# Sample Output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <ctype.h> | |
#include <time.h> | |
#include <dirent.h> | |
#include <unistd.h> | |
#include <getopt.h> |
OlderNewer