- 博客(7)
- 收藏
- 关注
原创 使用遗传算法求解三元函数最大值
使用遗传算法求解三元函数最大值使用遗传算法求解三元函数z的最大值z=f(x,y)=xsin(4πx)-ysin(4πy+π)+1在-1<x<1和-1<y<1上的最大值#include <bits/stdc++.h>using namespace std;#define pi acos(-1)//目标函数 double f(double x,double y){ return x*sin(4*pi*x)-y*sin(4*pi*y+pi)+1;}//编码
2020-11-25 20:43:42 3476
原创 Educational Codeforces Round 97 (Rated for Div. 2)
A Marketing Scheme#include <bits/stdc++.h>using namespace std;const int maxn=1e5+10;int T;int x,y;int main(){ cin>>T; while(T--){ cin>>x>>y; if(x*2>y) cout<<"YES"<<endl; else cout<<"NO"<&
2020-10-29 20:54:09 166
原创 后缀数组专练
Distinct Substrings模板#include <bits/stdc++.h>using namespace std;const int maxn=1e5+10;int sa[maxn];//SA数组,表示将S的n个后缀从小到大排序后把排好序的 //的后缀的开头位置顺次放入SA中int t1[maxn],t2[maxn],c[maxn];//求SA数组需要的中间变量,不需要赋值int rank[maxn],height[maxn];//待排序
2020-10-28 20:59:20 101
原创 Codeforces Round #679 (Div.2)
A. Finding Sasuken是偶数,输出相邻两个交换一个变负就可以了#include <bits/stdc++.h>using namespace std;const int maxn=110;int T;int n;int a[maxn];int main(){ cin>>T; while(T--){ cin>>n; for(int i=0;i<n;i++){ cin>>a[i]; } for(int
2020-10-27 22:29:13 121
原创 2019ccpc哈尔滨补题
E - Exchanging GiftsF - Fixing Banners因为每个字符串只能取一个,刚开始是觉得全部枚举也不会超,后来想想枚举也要用深搜,所以就先记录拥有各个字符的串,然后深搜;#include <bits/stdc++.h>using namespace std;const int maxn=2e6+10;int T;char s[maxn];vector<int>v[10];bool vis[10];bool dfs(int k){ b
2020-10-24 20:50:14 154
原创 Codeforces Round #676 (Div. 2)
A输出x xorxorxor y就可以了,刚开始拿个两个二进制看了一下代码还手打了个xor。。#include <bits/stdc++.h>using namespace std; int main(){ int T; scanf("%d",&T); int x,y; int ans,temp; while(T--){ scanf("%d%d",&x,&y); ans=0; temp=1; while(x!=0||y!=0){
2020-10-24 14:33:11 108
原创 Codeforces Round #677 (Div. 3)
Codeforces Round #677 (Div. 3)Codeforces Round #677 (Div. 3)A. Boring Apartments#include <bits/stdc++.h>using namespace std;int main(){ int T; cin>>T; int x; int ans; while(T--){ ans=0; cin>>x; int k=x%10; while(x%10!=0
2020-10-23 22:45:37 121
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人