上一页 1 2 3 4 5 6 ··· 9 下一页
摘要: 题目:158A - Next Round思路:水#include #include #include #include #include #include using namespace std;int num[51];int main(){ int n,k,x; int ans=0; cin>>n>>k; for(int i=1;i>num[i]; int tmp=k; while(tmp0) tmp--; cout<<tmp<<endl; return 0;}View Code 阅读全文
posted @ 2013-07-24 15:57 over_flow 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 题目:109A - Lucky Sum of Digits思路:扩展欧几里得#include #include #include #include #include #include using namespace std;long long exgcd(long long a,long long b,long long &x,long long &y){ if(b==0) { x=1; y=0; return a; } else { long long ans=exgcd(b,a%b,x,y); ... 阅读全文
posted @ 2013-07-23 09:23 over_flow 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目:A - Points on Line思路:二分找到不比当前值加差值打的最后一个数字,然后讨论#include #include #include #include #include #include using namespace std;long long node[100010];int fun(int l,int r,long long x){ if(l>=r) return l; int mid=(l+r)/2; if(node[mid]==x) return mid; if(node[mid]>n>>k; for(int... 阅读全文
posted @ 2013-07-22 22:54 over_flow 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 题目:171B - A star思路:递推#include #include #include #include #include #include using namespace std;int main(){ long long n; cin>>n; cout<<6*n*(n-1)+1<<endl; return 0;}View Code 阅读全文
posted @ 2013-07-22 21:51 over_flow 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/152/C思路:标记每位出现不同字母的次数即可,然后累乘取模#include #include #include #include #include #include using namespace std;#define mod 1000000007string s[110];mapmp;int main(){ int n,m; cin>>n>>m; for(int i=0;i>s[i]; long long ans=1; for(int i=0;i<m;i++) { 阅读全文
posted @ 2013-07-22 21:40 over_flow 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/131/C思路:打表或者直接暴力#include #include #include #include #include using namespace std;long long f[65][65];void init(){ for(int i=0;i>m>>n>>t; long long ans=0; int cnt; for(int i=4;i<=m;i++) { if(t-i<1) break; ans+=f[m][i]... 阅读全文
posted @ 2013-07-22 21:32 over_flow 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/124/B思路:学会用while(next_permutation(...))#include #include #include #include #include using namespace std;#define inf 0xfffffffint num[10][10];int p[10];int main(){ char s; int n,k; cin>>n>>k; for(int i=0;i>s; num[i][j]=s-'0'; }... 阅读全文
posted @ 2013-07-22 21:19 over_flow 阅读(128) 评论(0) 推荐(0) 编辑
摘要: #include #include #include #include #include using namespace std;int num[55];int main(){ int n,k; cin>>n>>k; for(int i=1;i>num[i]; sort(num+1,num+n+1); int cnt=n; while(k--) { cnt--; } if(cnt>=0) cout<<num[cnt]<<" "<<num[cnt]+1<<endl; else cout< 阅读全文
posted @ 2013-07-22 16:23 over_flow 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1573思路:同余方程,模板#include #include #include #include #include using namespace std;long long a[11],b[11];long long exgcd(long long a,long long b,long long &x,long long &y){ if(b==0) { x=1; y=0; return a; } else { lon... 阅读全文
posted @ 2013-07-19 09:28 over_flow 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题目:Prime Generator思路:分段筛素数#include #include #include #include #include #include using namespace std;#define maxn 40000int n_prime=0;bool vis[maxn];int prime[4210];bool cnt[100010];void Prime(){ memset(vis,true,sizeof(vis)); vis[0]=vis[1]=0; for(int i=2;i=l&&j<=r) cnt[j-l]... 阅读全文
posted @ 2013-07-18 20:06 over_flow 阅读(211) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 9 下一页