#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=;a%=mod; if(b<) return ; for(;b;b>>=){if(b&)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
struct Point{
db x,y;
}ans[maxn],p1,p2,o;
Point get_mid(Point p1,Point p2){
Point ret;
ret.x = (p1.x + p2.x) / ;
ret.y = (p1.y + p2.y) / ;
return ret;
}
Point get_o(Point p1,Point p2,int n1,int n2,int n){//正多边形中点,外接圆圆心
Point mid = get_mid(p1,p2),ret;
db ang = PI / 2.0 - 1.0 * (n2 - n1) * PI / n;
// 向量的思想
ret.x = mid.x - (p1.y - mid.y) * tan(ang);
ret.y = mid.y + (p1.x - mid.x) * tan(ang);
return ret;
}
db f(db x){//会出现-0的情况
return fabs(x)<eps?:x;
}
int main(){
int n,n1,n2;
scanf("%d%d%d",&n,&n1,&n2);
scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
if(n1 > n2) swap(n1,n2), swap(p1,p2);
n1--; n2--;
o = get_o(p1,p2,n1,n2,n);
db ang = 2.0 * PI / n;
ans[n1] = p1;
// dd(o.x)de(o.y)
for(int i = n1+; ;++i){
if(i%n==n1) break;
// x0,y0绕rx0,ry0逆时针旋转a度
// x0= (x - rx0)*cos(a) - (y - ry0)*sin(a) + rx0 ;
// y0= (x - rx0)*sin(a) + (y - ry0)*cos(a) + ry0 ;
ans[i%n].x = o.x + (ans[(i-+n)%n].x - o.x)*cos(-ang) - (ans[(i-+n)%n].y - o.y)*sin(-ang);
ans[i%n].y = o.y + (ans[(i-+n)%n].x - o.x)*sin(-ang) + (ans[(i-+n)%n].y - o.y)*cos(-ang);
}
rep(i,,n) printf("%.8f %.8f\n",f(ans[i].x),f(ans[i].y));
return ;
}

SGU 120

题意:给你正n边形上的两个点,让你求出正n边形上的所有点,1 - n是顺时针

收获:求正n边形中心或者说是外接圆的圆心,向量旋转的公式[x*cosA-y*sinA  x*sinA+y*cosA](向量逆时针旋转A)

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=;a%=mod; if(b<) return ; for(;b;b>>=){if(b&)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
struct Point{
db x,y;
}ans[maxn],p1,p2,o;
Point get_mid(Point p1,Point p2){
Point ret;
ret.x = (p1.x + p2.x) / ;
ret.y = (p1.y + p2.y) / ;
return ret;
}
Point get_o(Point p1,Point p2,int n1,int n2,int n){//正多边形中点,外接圆圆心
Point mid = get_mid(p1,p2),ret;
db ang = PI / 2.0 - 1.0 * (n2 - n1) * PI / n;
// 向量的思想
ret.x = mid.x - (p1.y - mid.y) * tan(ang);
ret.y = mid.y + (p1.x - mid.x) * tan(ang);
return ret;
}
db f(db x){//会出现-0的情况
return fabs(x)<eps?:x;
}
int main(){
int n,n1,n2;
scanf("%d%d%d",&n,&n1,&n2);
scanf("%lf%lf%lf%lf",&p1.x,&p1.y,&p2.x,&p2.y);
if(n1 > n2) swap(n1,n2), swap(p1,p2);
n1--; n2--;
o = get_o(p1,p2,n1,n2,n);
db ang = 2.0 * PI / n;
ans[n1] = p1;
// dd(o.x)de(o.y)
for(int i = n1+; ;++i){
if(i%n==n1) break;
// x0,y0绕rx0,ry0逆时针旋转a度
// x0= (x - rx0)*cos(a) - (y - ry0)*sin(a) + rx0 ;
// y0= (x - rx0)*sin(a) + (y - ry0)*cos(a) + ry0 ;
ans[i%n].x = o.x + (ans[(i-+n)%n].x - o.x)*cos(-ang) - (ans[(i-+n)%n].y - o.y)*sin(-ang);
ans[i%n].y = o.y + (ans[(i-+n)%n].x - o.x)*sin(-ang) + (ans[(i-+n)%n].y - o.y)*cos(-ang);
}
rep(i,,n) printf("%.8f %.8f\n",f(ans[i].x),f(ans[i].y));
return ;
}

SGU 186

题意:给你n个链子,每个链子有li个串,你可以在一个时间段里,把一个串从一个链子拆下来,然后用它把起来的链子连起来,

问你最少用多少时间来把所有的链子拼成一个链子

收获:贪心

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=;a%=mod; if(b<) return ; for(;b;b>>=){if(b&)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int l[maxn];
int main(){
int n;
scanf("%d",&n);
rep(i,,n) scanf("%d",l+i);
sort(l,l+n);
int sum = n - ,ans = ;;
rep(i,,n) {
while(l[i]--&&sum){
ans++;
sum--;
if(!sum) break;
}
if(!sum) break;
sum--;
}
printf("%d\n",ans);
return ;
}

SGU 226

题意:给你n个点,m个边,每个边有一个颜色,他要你找到点1到点n的最短距离,路径上的相邻两条边的颜色不能一样

收获:spfa + 颜色限制

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=;a%=mod; if(b<) return ; for(;b;b>>=){if(b&)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,m;
struct edge{
int v,nt,c;
}e[maxn*maxn];
int pre[maxn],tot;
int dis[][maxn];
bool in[maxn];
void init(){
tot = ;
mt(in,false);mt(pre,-);
rep(i,,) rep(j,,n+) dis[i][j] = inf;
dis[][] = dis[][] = dis[][] = dis[][] = ;
}
void add(int u,int v,int c){
e[tot].v = v;
e[tot].c = c;
e[tot].nt = pre[u];
pre[u] = tot++;
}
void spfa(){
queue<int> q;
q.push();
while(sz(q)){
int u = q.front(); q.pop(); in[u] = false;
de(u)
for(int i = pre[u]; ~i; i = e[i].nt){
int v = e[i].v , col = e[i].c;
rep(j,,) if(j != col) {
if(dis[col][v] > dis[j][u] + ){
dis[col][v] = dis[j][u] + ;
if(!in[v]) q.push(v),in[v] = true;
}
}
}
}
}
int main(){
scanf("%d%d",&n,&m);
init();
rep(i,,m) {
int u,v,c;
scanf("%d%d%d",&u,&v,&c);
add(u,v,c);
}
spfa();
int mn = inf;
// rep(j,1,n+1) rep(i,1,4) printf("%d%c",dis[i][j]," \n"[i==3]);
rep(i,,) mn = min(dis[i][n],mn);
printf("%d\n",mn==inf?-:mn);
return ;
}
/*
5 5
1 2 2
1 3 2
2 3 3
2 4 1
3 5 2 3 3
1 2 2
2 2 1
2 3 2
*/

SGU 174

题意:给你n个线段,线段只会在端点相交,然后问你到第几步的时候 ,线段围成一个封闭区间

收获:并查集无向图判环

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e5+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=;a%=mod; if(b<) return ; for(;b;b>>=){if(b&)res=res*a%mod;a=a*a%mod;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n;
int f[maxn<<];
void init(){
rep(i,,*n+) f[i] = i;
}
map<pii,int> m;
int id = ;
int get_id(pii x){
if(m.count(x)) return m[x];
m[x] = id; ++id;
return m[x];
}
int fd(int x) { return x==f[x]?x:f[x]=fd(f[x]); }
int main(){
int ans = ;
scanf("%d",&n);
init();
rep(i,,n+){
int x1,y1,x2,y2;
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
int id1 = get_id(mp(x1,y1));
int id2 = get_id(mp(x2,y2));
int f1 = fd(id1), f2 = fd(id2);
// dd(id1)dd(f1)dd(id2)de(f2)
if(f1 == f2) {
if(!ans) ans = i;
}
else f[f1] = f2;
}
printf("%d\n",ans);
return ;
}

SGU 224

题意:n*n的矩形放k个皇后

收获:位运算实现n皇后

大佬的题解:http://www.matrix67.com/blog/archives/266

我曾经傻傻的超时代码

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=; if(b<) return ; for(;b;b>>=){if(b&)res=res*a;a=a*a;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,k;
int ans = ;
int dp[];
int fd_pos(int now){
if(!now) return -;
rep(i,,n) if(kpow(,i) == now) return i;
}
bool ok(int x,int nowpos){
rep(i,,x){
int pos = fd_pos(dp[i]);
if(pos == -) continue;
if(pos == nowpos) return false;
if(abs(x - i) == abs(nowpos - pos)) return false;
}
return true;
}
void dfs(int x,int d){
if(x == n+){
if(!d) ans++;
return;
}
rep(i,,n){
int now = kpow(,i);
if(!ok(x,i) || !d) continue;
dp[x] = now;
if(d) dfs(x + ,d - );
}
dp[x] = ;
dfs(x + ,d);
}
int main(){
scanf("%d%d",&n,&k);
if(!k) return puts(""),;
if(k > n) return puts(""),;
dfs(,k);
printf("%d\n",ans);
return ;
}

AC代码

#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) (int)a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
#define all(a) a.begin(),a.end()
const int mod = 1e9+;
const int maxn = 2e2+;
const double eps = 1e-;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll gcd(ll a,ll b) { return a==?b:gcd(b%a,a); };
ll lcm(ll a,ll b) { return a/gcd(a,b)*b; }
ll kpow(ll a,ll b) {ll res=; if(b<) return ; for(;b;b>>=){if(b&)res=res*a;a=a*a;}return res;}
ll read(){
ll x=,f=;char ch=getchar();
while (ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while (ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
int n,k;
int ans = ;
int lowbit(int x) { return x & (-x); }
void dfs(int x,int l,int r,int d,int num){
if(num == k){
ans++;
return;
}
if(x == n + ) return;
int canpos = (( << n)- ) & (~(r | l | d));
while(canpos) {
int t = lowbit(canpos);
canpos -= t;
dfs(x + , (l | t) << , (r | t) >> , d | t,num + );
}
dfs(x + , l << , r >> ,d,num);
}
int main(){
scanf("%d%d",&n,&k);
if(!k) return puts(""),;
if(k > n) return puts(""),;
dfs(,,,,);
printf("%d\n",ans);
return ;
}

今日SGU 5.26的更多相关文章

  1. 今日SGU 6.6

    sgu 177 题意:给你一个一开始全是白色的正方形,边长为n,然后问你经过几次染色之后,最后的矩形里面 还剩多少个白色的块 收获:矩形切割,我们可以这么做,离散处理,对于每次染黑的操作,看看后面有没 ...

  2. 今日SGU 6.5

    sgu 160 题意:给你n个数字 数字范围 1 到 m 问你从中取出任意数量的数字使得这些数字的积取模m最大 收获:dp,记录dp的路径 #include<bits/stdc++.h> ...

  3. 今日SGU 5.30

    SGU 190 题意:给你个n*n的矩形,然后上面有几个点不能放东西,然后问你能不能用1*2的矩形,把能放 东西的地方放满 收获:一开始想的是,dfs,然后感觉这样的话,代码很长,而且很容易超时, 看 ...

  4. 今日SGU 5.29

    sgu 299 题意:给你n个线段,然后问你能不能选出其中三个组成一个三角形,数字很大 收获:另一个大整数模板 那么考虑下为什么如果连续三个不可以的话,一定是不存在呢? 连续上个不合法的话,一定是 a ...

  5. 今日SGU 5.28

    SGU 121 题意:给你一张图,问你每个顶点必须有黑白两条边(如果它的边数>=2),问你怎么染色,不行就输出no 收获:你会发现不行的情况只有一个单纯的奇数环的时候,反之我们交替染色即可 #i ...

  6. 今日SGU 5.27

    SGU 122 题意:给你n个人,每个人有大于 N / 2(向上取整)的朋友,问你1这个人有一个书,每个人都想看,只能从朋友之间传递,然后最后回到了1这个人,问你 是否有解,然后有解输出路径 收获:哈 ...

  7. 今日SGU 5.25

    SGU 194 题意:无源汇有上下界的最大流 收获:https://wenku.baidu.com/view/0f3b691c59eef8c75fbfb35c.html #include<bit ...

  8. 今日SGU 5.23

    SGU 223 题意:给你n*n的矩形,放k个国王,每个国王不能放在别的国王的8连边上,问你有多少种方法 收获:状态DP,因为每行的放置只会影响下一行,然我们就枚举每行的状态和对应的下一行的状态,当两 ...

  9. 今日SGU 5.22

    SGU 296 题意:给你一个最多1000位的数,让你删除k位使得剩下的数最大 收获:贪心 #include<bits/stdc++.h> #define de(x) cout<&l ...

随机推荐

  1. 电信流氓注入JS

    (function () { var cs_url = _pushshowjs_.url, cs_delay = window.cs_delay; var cs_styles = window.sty ...

  2. PHP简介 变量 输出

    一.PHP概念 Hypertext Preprocessor 超文本预处理器,是一种开源脚本语言,语法吸收了C语言,Java,Perl的特点,用于web开发领域, PHP是将程序嵌入到Html文档中执 ...

  3. Java获取环境变量和系统属性

    Java获取服务器环境变量和JVM系统变量    当程序中需要使用与操作系统相关的变量(例如:文件分隔符.换行符)时,Java提供了System类的静态方法getenv()和getProperty() ...

  4. (转载)Mac系统下利用ADB命令连接android手机并进行文件操作

    Mac系统下利用ADB命令连接android手机并进行文件操作 标签: Mac adb android 2016-03-14 10:09 5470人阅读 评论(1) 收藏 举报  分类: Androi ...

  5. nginx禁止特定UA访问

    一.UA是什么? User Agent 简称UA,就是用户代理.通常我们用浏览器访问网站,在网站的日志中,我们的浏览器就是一种UA. 二.禁止特定UA访问 最近有个网站(www.C.com)抄袭公司主 ...

  6. Remember the Word UVALive - 3942 DP_字典树

    每个小单词的长度都是小于等于100的,这是个重要的突破口. Code: #include <cstdio> #include <algorithm> #include < ...

  7. LRU算法与LRUCache

    关于LRU LRU(Least recently used,最近最少使用)算法是操作系统中一种经典的页面置换算法,当发生缺页中断时,需要将内存的一个或几个页面置换出,LRU指出应该将内存最近最少使用的 ...

  8. redis 多实例监控

    1.制作redis_low_discovery.sh脚本 mkdir -p /data/service/script/zabbix cd /data/service/script/zabbix cat ...

  9. linux在线添加硬盘、扫盘

    1:查看scsi 硬盘设备[root@web02 ~]# ls /sys/class/scsi_host host0 host1 host2 2:检查本机现有硬盘 [root@web02 ~]# fd ...

  10. 洛谷 P2009 跑步

    P2009 跑步 题目背景 跑步是一项有意思的运动,尤其是可以开发人的脑筋.常神牛很喜欢跑步. 题目描述 常神牛跑步的场地是一个多边形(边数≤20,每个顶点用英文大写字母表示),并且在这个多边形内部, ...