字符串快速排序 按字典序進行排序
各種OI測評系統中經常出現對字符串進行排序的題,以前我不太會字符串快排,結果都是用字典樹的遍歷進行的,現在終於會用qsort函數了,再次分享:
#include <iostream> #include <cstdio> #include <string> #include <cstring> #include <algorithm> using namespace std; int cmp(const void *a, const void *b) { return strcmp((*(string*)a).data(),(*(string*)b).data()); } string s[103]; int n; int main() { freopen("letter.in", "r", stdin); freopen("letter.out", "w", stdout); cin >> n; for(int i=0; i<=n; i++) getline(cin, s[i]); qsort(s+1, n+1, sizeof(string), cmp); for(int i=2; i<=n+1; i++) printf("%s\n", s[i].c_str()); return 0; }
2019年11月27日 18:29
Some of our office maintenance services happen to be unique even as do possibly not take any performance, superior service sending, and health with levity for WhiteSpot Maintenance Services. People ensure most of requests meant for office maintenance services happen to be treated utilizing urgency, and some of our clients happen to be assured the fact that their requests shall be treated throughout fifteen seconds.
2021年6月30日 23:33
The kind of home-based company that involves mind may be the trade associated with house piece of art. It's a undeniable fact that one method to success is actually performing an email finder service that many people will enjoyably purchase. The home painting business is generally a perfect fit considering the fact that it may be started either on the part period basis or full-time. Certainly among the requirements would be the business owner has to learn how you can paint. Though a few might prefer to say it will need many years to get down a legitimate trade for example painting, that actually isn't true any more.
2021年8月25日 21:39
Maintenance Services during Dubai may be a blessing for any residents together with expats. Keeping superior hygiene is certainly hectic for just anyone in any busy arrange. So it’s far better hire a competent and one of the greatest cleaning agencies in Dubai. Despite the fact that hiring those experts, you could relax despite the fact that professional cleaning solutions make an individual's cleaning on your behalf.
2021年10月01日 21:52
If you think involving home cleanup companies, you could think that that these firms offer are generally standard services including dusting along with vacuuming. It's not the scenario, though. The truth is, you could hire a firm like this specific for various household tasks. One in the types involving duties that they assist using is corporation. If you happen to be a quite unorganized man or woman and have no clue how to acquire your property organized, you'll be able to hire an experienced for support. This is just not something that you can be embarrassed to perform. It may actually change your health, your mood and a lot of other issues.
2023年8月30日 23:49
Good is relative to the charge. If you believes that painting guess is much too low then they might consider that the car paint contractor might be either affordable balling, inexperienced and / or cutting will cost you by cheapening the effort and for some reason or a second. The customer will likely then believe quite possibly not getting good value from who paint estimate and often will not and yet from who contractor even in the event the price is leaner.