Posted 06/29/2016Updated 08/18/2025 Semprathlon / Simfae Dean Servera minute read (About 198 words)解决jdbc连接SQL Server常见连接错误错误信息:通过端口 1433 连接到主机 localhost 的 TCP/IP 连接失败。错误:“connect timed out。请验证连接属性。确保 SQL Server 的实例正在主机上运行,且在此端口接受 TCP/IP 连接,还要确保防火墙没有阻止到此端口的 TCP 连接。”。 重要前提: 确保数据库允许远程连接 确保登录名允许远程连接 检查错误:打开Sql Server Configuration Manager,选中左栏SQL Server网络配置=>< 服务名>的协议,双击TCP/IP以弹出对话框。 特别注意最下方IPAll项的端口设置。按图设置,重启SQL Server服务后生效。 telnet 127.0.0.1 1433 可供测试端口。
Posted 06/17/2016Updated 08/18/2025 Semprathlon / Simfae Dean ACM-ICPC / Programing7 minutes read (About 982 words)2016江南大学ACM俱乐部招新赛匆忙而简捷地办完了年度招新活动,实现了第一次JNUOJ线上赛。 搭建OJ时不能实现预期中的多服务器并行处理,但评测效率已满足需求 VJ始终无法使用,不知原BNUOJ开发者是否会继续维护 命题未免太强调难度了 A. 篱笆和人#include #include #include #include #include #include #include #include #include #include using namespace std; const int N=100005; const int mod=1e9+7; typedef struct node { int x,y; bool operator < (const node &other) const { if(x!=other.x) return y B. Water Problem面向新人的提示:不必使用循环结构…… #include #include #include using namespace std; int main() { long long t; while(scanf("%lld",&t)!=EOF) { if(!(t%2)) { printf("%lld\n",((t/2-1)/2)); } else { printf("0\n"); } } return 0; } C. 交点已知不存在三线交于一点的情况。圆内一个交点就可由两条线段决定,两条线段又由圆上的四个不同点决定。从圆上选取4个点的组合, $ C^4_n = \frac{n(n-1)(n-2)(n-3)}{24}$。另还有圆上的n个点要计算。 T=int(input()) while T>0: T-=1 n=int(input()) print n+n*(n-1)*(n-2)*(n-3)/24 D. 食物处理器#include #include #include #include #include #include #include #include #include #include using namespace std; const int N=100005; const int mod=1e9+7; int val[N]; int main() { int k,n,h,c; long long time=0; while(scanf("%d %d %d",&n,&h,&k)!=EOF) { c=0,time=0; for(int i=1;i<=n;i++) { scanf("%d",&val[i]); } for(int i=1;i<=n;i++) { while(c+val[i]>h) { if(c>k) { int qwe=c; qwe/=k; time+=qwe; c=c%k; } else { c-=k; if(c<0) c=0; time++; } } c+=val[i]; } time+=c/k; if(c%k!=0) { time++; } cout< E. 最大计算值#include #include #include using namespace std; char s[111]; int num[111]; int dp[111][111]; char cal[111]; int calu(int a,int b,char c) { if(c=='*') return a*b; else if(c=='+') return a+b; else if(c=='-') return a-b; } int main() { int T; scanf("%d",&T); for(int i=0;i='0'&&s[i]<='9') { k*=10; k+=s[i]-'0'; i++; } dp[len++][len-1]=k; cal[len-1]=s[i]; } for(int i=2;i<=len;i++) { for(int l=0;l=len)break; for(int k=l;k F. 有趣的字符串#include using namespace std; const int maxn=100005; char s[maxn]; int a[maxn]; int n,k; int work(){ int s=0,t=0,ans=0; int cnt=0; while( s<=t ){ while( cnt<=k &&t 稍暴力些的做法也可: #include using namespace std; const int maxn=100005; char s[maxn]; int a[maxn]; int n,k; int dp[maxn]; int work(){ int ans=0; for(int i=1;i<=n;i++){ for(int j=i;j<=n;j++){ int tmp=dp[j]-dp[i-1]; if(tmp<=k) ans=max(ans,j-i+1); } } return ans; } int main() { int t; scanf("%d",&t); while(t--){ scanf("%d%d",&n,&k); scanf("%s",s); //cout<<"haha"< G. 我的世界/** Sep 19, 2015 7:12:36 PM * PrjName:Bc56-01 * @author Semprathlon */ import java.io.*; import java.util.*; public class Main { /** * @param args */ final static int maxn=110; static int cnt; static int[] w; static HashMap mp=new HashMap(); public static void main(String[] args){ // TODO Auto-generated method stub Scanner in=new Scanner(System.in); PrintWriter out=new PrintWriter(System.out); int T=in.nextInt(); //h=new int[maxn]; w=new int[maxn]; while(T-->0){ int n=in.nextInt(); cnt=0; mp.clear(); Arrays.fill(w, 0); for(int i=1;i<=n;i++){ int k=in.nextInt(); if (mp.containsKey(k)) w[mp.get(k)]+=in.nextInt(); else{ w[cnt]+=in.nextInt(); mp.put(k, cnt++); } } int sum=0; for(int i=0;i H. 尼古拉斯和数组#include #include #include #include #include using namespace std; const int maxn=105; int num[maxn]; int main() { int n; while(~scanf("%d",&n)) { memset(num,0,sizeof(num)); for(int i=1;i<=n;i++) { scanf("%d",&num[i]); } int minpos=0; int maxpos=0; for(int i=1;i<=n;i++) { if(num[i]==1) { minpos=i; } if(num[i]==n) { maxpos=i; } } int len=0; len=abs(maxpos-minpos); int ans=0; if(len==n-1) { ans=n-1; } else { ans=max(ans,abs(maxpos-1)); ans=max(ans,abs(n-maxpos)); ans=max(ans,abs(minpos-1)); ans=max(ans,abs(minpos-n)); } cout << ans << endl; } return 0; } I. 奇妙的&操作#include #include #include #include #include using namespace std; typedef long long ll; const ll mod=1000000007; char s[111111]; int cal(int num) { int res=6; for(int i=0; i<6; i++) if((1<='0'&&s[i]<='9') num=s[i]-'0'; else if(s[i]>='a'&&s[i]<='z') num=s[i]-'a'+36; else if(s[i]>='A'&&s[i]<='Z') num=s[i]-'A'+10; else if(s[i]=='-') num=62; else num=63; int k=cal(num); while(k--) { ans*=3; ans%=mod; } ans%=mod; } //cout< J. 推箱子【题意存疑】怎样在单个地读入字符时排除换行符的影响? #include #include #include #include #include using namespace std; int main() { char y,x; int n; while(scanf(" %c ",&y)!=EOF) { scanf("%d",&n); if(n&1) { if(y=='A') printf("B\n"); else printf("A\n"); } else { printf("%c\n",y); } } return 0; }
Posted 06/10/2016Updated 08/18/2025 Semprathlon / Simfae Dean Servera minute read (About 138 words)【160610】服务器管理记录 Ubuntu查看运行中的进程及其id、监听端口 sudo netstat -anp 查询进程id pidof 安全终止某个进程 kill -15 后台运行某个进程 nohup& 内存空间不足的临时解决办法How To Create A Swap File In Linux linux下由于内存不足造成的 virtual memory exhausted: Cannot allocate memory, qt **.o文件 file not found configure-apache-to-listen-on-port-other-than-80 http://askubuntu.com/questions/256013/could-not-reliably-determine-the-servers-fully-qualified-domain-name
Posted 06/01/2016Updated 08/18/2025 Semprathlon / Simfae Dean Abouta few seconds read (About 62 words)Wordpress 更新错误刚才升级到WP 4.5.2的时候报了个错,无法复制文件。 就像这样,然而并不是权限设置的错。 其实是虚拟主机空间不够了。
Posted 05/20/2016Updated 08/18/2025 Semprathlon / Simfae Dean Developing / Weba few seconds read (About 59 words)即时学习js前端开发的一些体会没有原生支持的类,如何“面向对象”开发 弱类型的js如何判断类型 改善numeric的计算误差
Posted 05/17/2016Updated 08/18/2025 Semprathlon / Simfae Dean Programinga few seconds read (About 27 words)Java中一些基本类型的内存占用你真的知道Java中boolean类型占用多少个字节吗?
Posted 05/12/2016Updated 08/18/2025 Semprathlon / Simfae Dean Programinga few seconds read (About 72 words)atom编码简记尝试转入这个github推荐的代码编辑器。 宣传视频非常有趣。 在github平台的依托下,Atom在主题风格、插件扩展上异常灵活。 甚至提供apm install atom-beautify这种命令行安装扩展的方式。
Posted 05/04/2016Updated 08/18/2025 Semprathlon / Simfae Dean a few seconds read (About 55 words)ACM竞赛专题 高质量文摘埃氏筛法、欧拉筛法、积性函数线性筛与莫比乌斯反演 各种字符串Hash函数比较
Posted 04/29/2016Updated 08/18/2025 Semprathlon / Simfae Dean Programinga few seconds read (About 33 words)在Eclipse中查看jdk源代码为了帮助初学Java的同学,现给出查看jdk源代码的提示: 相关文件为$JAVA_HOME$/src.zip
Posted 04/27/2016Updated 08/18/2025 Semprathlon / Simfae Dean ACM-ICPC / Programinga minute read (About 182 words)POJ 1177 矩形周长并 扫描线 计算当前扫描线上“进出”矩形的次数,乘上对应“事件”的边长。 /* * File: main.cpp * Author: semprathlon * * Created on April 26, 2016, 7:18 PM */ #include #include #include #include #include using namespace std; struct Rectangle{ int x1,y1,x2,y2; Rectangle(){} Rectangle(int _x1,int _y1,int _x2,int _y2):x1(_x1),x2(_x2),y1(_y1),y2(_y2){} }; vector rects; bool cmp(const int& a,const int& b){ if (abs(a-b)<1e-5) return 0; return a-b<0; } int unionPerimeterY(const vector& rects){ if (rects.empty()) return 0; typedef pair > Event; vector events; vector ys; for(int i=0;iy2) swap(y1,y2); sum[y1]+=delta; sum[y2]-=delta; int cnt=0,tmp=0; for(int j=0;j& rects){ if (rects.empty()) return 0; typedef pair > Event; vector events; vector xs; for(int i=0;ix2) swap(x1,x2); sum[x1]+=delta; sum[x2]-=delta; int cnt=0,tmp=0; for(int j=0;j>n){ if (!n) break; rects.clear(); for(int i=0;i>x1>>y1>>x2>>y2; rects.push_back(Rectangle(x1,y1,x2,y2)); } cout<