PAT STL 有的時間限制

2021-10-03 19:28:51 字數 2443 閱讀 2533

//map是通過鍵值排序的

//1.第一次用map, 時間超限兩個

//2.第二次, 用hash, 輸出string用cout, 時間超限乙個

//3.第三次, 用hash,輸出string用%s, str.c_str(), 通過

//4.邏輯不變, 小小的幾個改動就能影響好多樣例

//1.核心: 學會辨別使用stl, 然後又時間限制的題目

//2.想要用 printf()輸出string, 用%s, str.c_str()

不比vector.sort省時間

//4.組織**時盡量按最省的來

//5.能用陣列hash, 就盡量不要用map

#include #include #include #include #include #include using namespace std;

int n, k;

vector>results;

int main()

} for (int i = 1; i < results.size(); i++)

for (int i = 1; i < results.size(); i++)

id = id * 10 + str[3] - '0';

return id;

}int main()

} 排序

//unordered_map>::iterator it;

//for (it= inputs.begin(); it!=inputs.end(); it++)

// for (int i = 0; i < n; i++)

sort(inputs[get_id(str)].begin(), inputs[get_id(str)].end());

printf("%s %d", str.c_str(), inputs[get_id(str)].size());

for (int j = 0; j < inputs[get_id(str)].size(); j++) printf(" %d", inputs[get_id(str)][j]);

//set::iterator it;

//for (it = inputs[str].begin(); it != inputs[str].end(); it++)printf(" %d", *it);

printf("\n");

} return 0;

}// 1.讀懂題目設計好邏輯很重要

// 2.string如果想擦除某些字元的話, 其實也可以replace(起點,個數, "");

// 3.map可以直接erase擦除鍵, 而不是iterator

#include#include#include#includeusing namespace std;

string s;

int k;

bool a[127] = ;//ascii

mapma;

int main()

map::iterator it = ma.begin();

for (it; it != ma.end(); it++)

if (count&&count%k != 0)

else j++;

}} }

int i = 0;

bool print[128] = ;

while(i#include #include #include #include #include using namespace std;

mapmp;

string a;

string ans;

int main()

cout << ans << endl;

return 0;

}

//1.請注意最後一行, %  的輸出

#include #include #include using namespace std;

int main()

v[i] = s;

}scanf("%d", &k);

for(int i = 0; i < k; i++)

double ans = (double)nc / nt * 100;

printf("%.1f%%\n", ans);

}return 0;

}

// 1.核心: 尋找唯一能使成功的情況, 剩下的情況都為false

非ascii字元

#include#include#includeusing namespace std;

int main()

}if(index==n) flag=true;

if(flag) printf("yes\n");

else printf("no\n");

} return 0;

}

mysql date ad mysql 時間限制

n天內記錄 where to days now to days 時間字段 n 今天的記錄 where date 時間字段 date now 或where to days 時間字段 to days now 查詢一周 select from table where date sub curdate in...

vue 時間外掛程式限制選擇時間

el date picker設定日期選擇範圍 這個場景是在乙個頁面中有兩個日期選擇框,其中乙個的日期只能在另乙個的範圍內進行選擇,貼 template 以上重點是繫結picker options picker options pickeroptions script data var self th...

去除Lingoes時間限制

2009 10 11 lingoes 2.5.3beta 又要強行公升級了 這意味著我又要重新裝一遍詞典,詞典的安裝檔案早就被刪了,嘗試破解之。修改資源無果,在mfc的messagemap密林裡徘徊許久後忽然發現還沒試過修改時間這個最基本方法。於是將系統時間調回乙個月,竟然不提示過期了 好吧,lin...