OpenJudge
CyuuniChin
这个作者很懒,什么都没留下…
展开
-
[OpenJudge-NOI]乘积最大的拆分
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;int sum(0),a[20005],n,i,ma;int main(){ cin>>n; for(i=2;sum+i<n;i++){ a[i-1]=i; sum+=i; } s原创 2015-11-04 12:26:11 · 782 阅读 · 0 评论 -
[OpenJudge-NOI]取石子游戏
代码#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>using namespace std;int ans;int Check(int a,int b) { ans++; if(a==b){ if(ans%2==1) return 1;else return原创 2015-11-04 14:34:39 · 400 阅读 · 0 评论 -
[OpenJudge-NOI]走出迷宫 Bfs
代码#include <cstdio>#include <cstring>#include <iostream>#include <queue>using namespace std;int n,m,ans,vis[1000][1000];char mat[1000][1000],dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}}; ;struct Point{原创 2015-11-04 14:33:27 · 664 阅读 · 0 评论 -
[OpenJudge-NOI]算24 Dfs
代码#include <cstdio>#include <iostream>#include <cstring>#include <cmath>using namespace std;double a[5];int Dfs(int k){ if(k==1){ if(fabs(a[0]-24)<1e-6){ return 1; }原创 2015-11-04 16:29:47 · 582 阅读 · 0 评论 -
[OpenJudge-NOI]2011 快速幂
题目大意求2011的n次方,n为高精度数题目大意枚举可以发现n=500时为1;所以取末三位对500取模代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;typedef long long ll;ll Quick_Pow(ll a,ll b){ ll re=1; while(b原创 2015-11-05 10:36:01 · 799 阅读 · 0 评论 -
[OpenJudge-NOI]走迷宫 Bfs
代码#include <cstdio>#include <iostream>#include <cstring>#include <algorithm>#include <queue>using namespace std;int r,c,vis[1000][10000],dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}},ans;char mat[1000][1原创 2015-11-05 10:02:19 · 665 阅读 · 0 评论 -
[OpenJudge-NOI]Set stl
代码#include <cstdio>#include <cstring>#include <iostream>#include <set>#include <algorithm>using namespace std;multiset<int> s;int n,x,f[100005];char op[1000];int main(){ cin>>n; memset(f原创 2015-11-05 11:12:46 · 330 阅读 · 0 评论 -
[OpenJudge-NOI]走出迷宫 Bfs
代码#include <cstdio>#include <cstring>#include <iostream>#include <queue>using namespace std;int n,m,ans,vis[1000][1000];char mat[1000][1000],dir[4][2]={{0,1},{0,-1},{1,0},{-1,0}}; ;struct Point{原创 2015-11-05 10:04:04 · 1304 阅读 · 0 评论 -
[OpenJudge-NOI]List stl
代码#include <cstdio>#include <iostream>#include <cstring>#include <list>#include <map>using namespace std;map<int,list<int> > m;int n,x,y;char op[10000];int main(){ scanf("%d",&n); while(原创 2015-11-05 13:50:59 · 634 阅读 · 0 评论 -
[OpenJudge-NOI]词典 stl
代码#include <cstdio>#include <iostream>#include <cstring>#include <map>#include <string>using namespace std;char str[100005],a[100005],b[100005];map<string,string> m;int main(){ while(gets(str原创 2015-11-05 11:11:51 · 487 阅读 · 0 评论 -
[OpenJudge-NOI]最接近的分数
代码#include <cstdio>#include <iostream>#include <cstdio>#include <cmath>using namespace std;int n,a,b,ra(0),rb(0),maxr=0;int Gcd(int x,int y){ if(y==0) return x; else return Gcd(y,x%y);}in原创 2015-11-04 14:20:43 · 1672 阅读 · 0 评论 -
[OpenJudge-NOI]棋盘问题 回溯
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;char a[100][100];int vis[100],ans,n,k;int Backtrack(int cur,int num) { if(num>k){ ans++; return 1;原创 2015-11-04 14:31:46 · 825 阅读 · 0 评论 -
[OpenJudge-NOI]滑雪 记忆化搜索+Dp
代码#include <cstdio>#include <cstring>#include <iostream>#include <algorithm>using namespace std;int r,c,mat[105][105],cnt[105][105],dir[4][2]={{1,0},{-1,0},{0,-1},{0,1}},ans(0);int dp(int i,int j){原创 2015-11-04 14:30:22 · 436 阅读 · 0 评论 -
[OpenJudge-NOI]连乘积末尾0的个数
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;int a,b;int main() { cin>>a>>b; int i1(0),i2(0); for(int i=a;i<=b;i++) { int x; x=i; w原创 2015-11-04 12:27:33 · 498 阅读 · 0 评论 -
[OpenJudge-NOI]最大公约数与最小公倍数
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;typedef long long ll;ll Gcd(ll a,ll b) { if(b==0) return a; return Gcd(b,a%b);}ll gcd,lcm,minn=10000000,a,b;int原创 2015-11-04 12:30:19 · 580 阅读 · 0 评论 -
[OpenJudge-NOI]余数相同问题 暴力
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;int main() { long long a,b,c; cin>>a>>b>>c; for(long long i=2;i<=1000000;i++) { if(a%i==b%i&&b%i==c%i)原创 2015-11-04 12:23:25 · 1289 阅读 · 0 评论 -
[OpenJudge-NOI]不定方程求解 扩展欧几里德
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;typedef long long ll;int ExGcd(int a,int b,int& x,int& y) { if(b==0){ x=1;y=0; return a; } in原创 2015-11-04 12:25:01 · 571 阅读 · 0 评论 -
[OpenJudge-NOI]质数的和与积
代码#include <cstdio>#include <cmath>long long maxx;int Check(int n) { int f=0; for(int i=2;i<=sqrt(n);i++) { if(n%i==0) f=1; } if(f==1) return 0; else return 1;}int main原创 2015-11-04 12:28:43 · 1155 阅读 · 0 评论 -
[OpenJudge-NOI]神奇序列求和
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;int x,y,n,ans(0);int main() { cin>>x>>y>>n; ans=x+y; for(int i=1;i<=n;i++) ans=ans*3-(x+y); cout<<ans<<end原创 2015-11-04 12:31:10 · 890 阅读 · 0 评论 -
[OpenJudge-NOI]最大公约数与最小公倍数
代码#include <cstdio>#include <iostream>#include <cstring>using namespace std;int Gcd(int a,int b) { return b==0?a:Gcd(b,a%b);}int a,b,n,ans;int main() { cin>>a>>b>>n; int t=Gcd(a,b);原创 2015-11-04 14:19:53 · 541 阅读 · 0 评论 -
[OpenJudge-NOI]求小数的某一位
代码#include <cstdio>#include <iostream>using namespace std;long long Quick_Power(long long a,long long b){ long long re=1; while(b){ if(b&1){ re*=a; re%=1000;原创 2015-11-04 14:21:49 · 506 阅读 · 0 评论 -
[OpenJudge-NOI]最大子矩阵 贪心
代码#include <cstdio>#include <cstring>#include <iostream>using namespace std;int g[200][200],cur[200][200][100];int n;void Pretreatment() { for(int k=0;k<n;k++) for(int i=0;i<n;i++){原创 2015-11-04 14:26:26 · 1484 阅读 · 0 评论 -
[OpenJudge-NOI]最低通行费 Dp
代码#include <cstdio>#include <cstring>#include <iostream>using namespace std;int n,mat[105][105],dp[105][105];int main() { cin>>n; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){原创 2015-11-04 14:28:30 · 381 阅读 · 0 评论 -
[OpenJudge 7834]分成互质组 迭代加深+剪枝
题目大意给定n个素,求至少能分成多少互质组代码#include <cstdio>#include <iostream>#include <cstring>#include <ctime>using namespace std;int n,a[100],b[100]={0},maxd(0),f(0),gcd[20005][20005];int Stein(int u,int v){原创 2015-10-30 19:05:50 · 1163 阅读 · 0 评论