2017-07-10:考試(再次爆int,記住用long long)
Now the commencement speakers will typically also wish you good luck and extend good wishes to you. I will not do that, and I’ll tell you why.
From time to time in the years to come, I hope you will be treated unfairly, so that you will come to know the value of justice.
I hope that you will suffer betrayal because that will teach you the importance of loyalty.
Sorry to say, but I hope you will be lonely from time to time so that you don’t take friends for granted.
I wish you bad luck, again, from time to time so that you will be conscious of the role of chance in life and understand that your success is not completely deserved and that the failure of others is not completely deserved either.
And when you lose, as you will from time to time, I hope every now and then, your opponent will gloat over your failure. It is a way for you to understand the importance of sportsmanship.
I hope you’ll be ignored so you know the importance of listening to others,
and I hope you will have just enough pain to learn compassion.
Whether I wish these things or not, they’re going to happen.And whether you benefit from them or not will depend upon your ability to see the message in your misfortunes.
一題:快速冪用long long;
二題:用陣列會爆記憶體,所以用vector;
用vector的好處:
在子函式內部定義vector是動態儲存的,當再次返回此狀態時,原來的vector內的資料仍然存在
#include<vector>;
vector<long long>vec;
vec.push_back(x);
tot++;
sort(vec.begin(),vec.end());
y=vec[tot-1];
三題:
1.曼哈頓距離:
紅色線為曼哈頓距離,綠色線為歐式距離(直線距離),藍色與黃色為等價曼哈頓距離