摘要: 思路: 并查集的题,用dfs做的,深搜首字母 注意数据结构,保存字符串的首尾字母即可,最初保存整个字符串,结果memory limit #include #include #include #include using namespace std; struct st{ char f,e; }arr[10000]; bool mar[10000]={0}; void dfs(char)... 阅读全文
posted @ 2017-02-14 11:08 朤尧 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 思路: 用数组模拟走廊,搬桌子时将那一段value+1,输出数组最大值即可 阅读全文
posted @ 2017-02-14 11:00 朤尧 阅读(218) 评论(0) 推荐(0) 编辑
摘要: 示例: 阅读全文
posted @ 2017-02-11 12:13 朤尧 阅读(497) 评论(0) 推荐(0) 编辑
摘要: 思路: 1.枚举两点确定圆心,大于2不用考虑 2.逐个判断判断距圆心的距离小于1.00001符合题意 这个题,主要在求圆心上废了不少功夫,但是仍存在问题 阅读全文
posted @ 2017-02-11 11:50 朤尧 阅读(278) 评论(0) 推荐(0) 编辑
摘要: java大数判断相等: 1.equals()方法 2.compareTo() 方法区别: 2.00与2.0 equals()方法判断不等,compareTo()方法判断相等.科学的说法可以看java api文档 equals()方法加striptrailingzeros()方法等效于compareT 阅读全文
posted @ 2017-02-11 11:28 朤尧 阅读(673) 评论(0) 推荐(0) 编辑
摘要: java大数做斐波那契数列: 思路:1. 2.可以用数组存着 阅读全文
posted @ 2017-02-11 11:16 朤尧 阅读(651) 评论(1) 推荐(0) 编辑
摘要: java大数取余: 类方法:BigInteger.divideAndRemainder() 返回一个数组,key = 0为商key = 1为余数 阅读全文
posted @ 2017-02-11 11:04 朤尧 阅读(740) 评论(0) 推荐(0) 编辑
摘要: 表示看这篇博客后找到了思路: http://blog.csdn.net/queuelovestack/article/details/47291195 补充一下数据,方便观察规律 m LBorderm m-LBorder fibn 1 0 1 1 2 0 2 1 3 1 2 2 4 1 3 3 5 阅读全文
posted @ 2017-02-10 19:27 朤尧 阅读(223) 评论(0) 推荐(0) 编辑
摘要: //NYOJ--水池数目 #include #include const int MAX_SIZE{102}; using namespace std; void dfs(int,int); int map[MAX_SIZE][MAX_SIZE]; int main(){ //freopen("input.txt","r",stdin); int N; cin>>N; ... 阅读全文
posted @ 2017-02-10 18:42 朤尧 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 按照思路写:深搜,r控制位数,位数为0输出否则递归 阅读全文
posted @ 2017-02-10 18:42 朤尧 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 题意,N座城市有N-1条路,目的是找到哪个城市可以到目的城市 //NYOJ--search--吝啬的国度 #include #include #include using namespace std; vector city[100005]; int road[100004]; int N,S; void dfs(int); int main(){ // freopen("in... 阅读全文
posted @ 2017-02-10 18:41 朤尧 阅读(217) 评论(0) 推荐(0) 编辑
摘要: #include #include #include void priTable(); using namespace std; int arr[30]; int main() { int n; priTable(); while(cin>>n && n!=0){ cout<<arr[n-1]<<endl; } return 0; } vo... 阅读全文
posted @ 2017-02-10 18:39 朤尧 阅读(271) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; vector table; void priTable(); int primeNumber(int); int main() { int n; priTable(); while(cin>>n && n!=0){ int count=0; for(vector:... 阅读全文
posted @ 2017-02-10 18:39 朤尧 阅读(252) 评论(0) 推荐(0) 编辑
摘要: #include #include #include struct news{ int lev; int num; bool operator lev==a.lev?this->num>a.num:this->lev>n) { int cut=0; priority_queue q[4]; for(int i... 阅读全文
posted @ 2017-02-09 16:00 朤尧 阅读(265) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main() { string str; while(getline(cin,str)){ stack s; for(char c:str){ if(!s.empty() &&s.top()=='(' && c==')'... 阅读全文
posted @ 2017-02-09 16:00 朤尧 阅读(255) 评论(2) 推荐(0) 编辑