摘要: 用map比较容易 ,但是要注意没一个case都需要清空一下map 嗯这里贡献了一次Wa#include <iostream>#include <string>#include <map>using namespace std;int main(){ int test; int n; cin>>test; string str[400]; string str1,str2; int s; int cas=0; while(test--) { map<string,string>map1; map1.clear(); map<str 阅读全文
posted @ 2011-06-16 22:35 dapanshe 阅读(152) 评论(0) 推荐(0) 编辑
摘要: 这题用cin 和cout 超时 悲催#include <iostream>#include <algorithm>using namespace std;int fact[5] = {1,1,2,6,24};int main(){ int a[1025]; int test; scanf("%d",&test); int i,j; while(test--) { int n,k; scanf("%d%d",&n,&k); i=0; if(n<5) k %= fact[n]; while(i<n) 阅读全文
posted @ 2011-06-16 21:44 dapanshe 阅读(266) 评论(0) 推荐(0) 编辑
摘要: set会自动排序,这个号省时间#include<iostream>#include<set>using namespace std;int main(){ set<long long>s; long long a[1510]; s.insert(1); int i; for(i=1;i<=1500;i++) { a[i] = *s.begin(); s.erase(s.begin()); s.insert(a[i]*2); s.insert(a[i]*3); s.insert(a[i]*5); } int n; while(cin>>n & 阅读全文
posted @ 2011-06-16 20:35 dapanshe 阅读(408) 评论(0) 推荐(0) 编辑