C语言
千千千千尺
拒绝溺死于鸡汤
展开
-
foj部分题解
1001 Duplicate Pair#include<cstdio>#include<iostream>#include<string>#include<string.h>using namespace std;bool arr[1000010];int main(){ freopen("xx.in","r",stdin); freopen("xx.out","w",st原创 2016-05-19 10:16:32 · 443 阅读 · 0 评论 -
广搜(BFS)学习笔记
(Board First Search) (图为二叉树的层序遍历) BFS得到顺序:ABCDEFG与DFS的区别:深度优先(优先往深处走),用的数据结构是栈, 主要是递归实现;广度优先(优先走最近的),用的数据结构是队列,主要是迭代实现;bfs通过检测边发现点,被发现点(但未探索)入队。(被探索是指是否检测过与该点相关联的临近顶点)一个顶点被完全探索当且仅当他的所有边被检测。一个顶点探原创 2016-04-23 00:01:16 · 1691 阅读 · 0 评论 -
第五章-算法入门
5.1 equation #include<iostream> #include<stdio.h> #include<string> using namespace std; double calcul(double x) { return 8*x*x*x*x + 7*x*x*x + 2*x*x +3*x + 6; } int main() { d原创 2016-04-22 15:08:57 · 237 阅读 · 0 评论 -
(大一下)第一章-数组
1.1 number #include<iostream> #include<stdio.h> #include<string> using namespace std; bool arr[10011]; int main() { string s; cin >> s; for(int i = 0; i<s.length();i++)原创 2016-04-07 20:40:23 · 334 阅读 · 0 评论 -
第二章-函数
2.1 prime #include<iostream> #include<stdio.h> #include<string> using namespace std; bool check(int n) //判断是否为质数 { if(n == 1) return false; if(n == 2) return原创 2016-04-07 20:53:48 · 2215 阅读 · 0 评论 -
第三章-指针
3.1 OCD #include<iostream> #include<stdio.h> #include<string> using namespace std; int arr[5050]; char cha[5050][150]; int n; int re() { int min = 15000; int minid = -1;原创 2016-04-07 21:05:05 · 266 阅读 · 0 评论 -
第四章-结构体
4.1 scores #include<iostream> #include<stdio.h> #include<string> using namespace std; struct student { int classnum; int number; int score; }stu[2010]; int main() {原创 2016-04-16 22:55:09 · 242 阅读 · 0 评论 -
记录下第一次玩深搜的两题(DFS/回溯)
2.4 小z的房子 #include<iostream> #include<stdio.h> #include<string> using namespace std; int arr[200][200]; int move[4][2] = { {-1,0} , {1,0} , {0,-1} , {0,1} }; void DFS(int x,int y) {原创 2016-03-13 07:44:12 · 350 阅读 · 0 评论 -
随机字符串
资料1来源: http://zhidao.baidu.com/link?url=dcVL1oNt7OH6X25SBHUefIKNtfHuEkuWr95HMPVLsQtSPjqKfEhyv82HE6sNzz8EOnsJppjNaSPXYLR8jqFOq_ 直接产生随机的字符串的库函数是没有的,但是可以这么实现: 1.产生固定长度的随机的字符串 主要就是产生固定个数的随机字符, 那么就简单了,原创 2016-02-03 23:00:38 · 829 阅读 · 0 评论 -
第七章-结构体
本章题目有毒!!有毒!!!有毒!!! (基友认出一个东方project,请小伙伴愉快地告诉我剩下的都是什么游戏/番【剧毒出题人)7.1cirno //小朋友#include<stdio.h>#include<iostream>using namespace std;struct student{ int num; int score;}stu[1001];int m原创 2016-01-04 23:08:42 · 452 阅读 · 0 评论 -
第六章-指针(事实上全程压根没用指针hhhh_(:зゝ∠)_
6.1Time_List //小朋友#include<stdio.h>int main(){ int i; int n; int arr[100086]={0}; scanf("%d",&n); for(i=1;i<=n;i++) scanf("%d",&arr[i]); //读完数据 int min=arr[1];原创 2016-01-04 22:53:50 · 524 阅读 · 0 评论 -
第五章-函数
5.1 transpose //小朋友#include<stdio.h> int arr[200][200]; int arr2[200][200]; int n; int i,j; int main(){ scanf("%d",&n); for(i=0;i<n;i++) for(j=0;j<n;j++)原创 2015-12-12 15:23:37 · 470 阅读 · 0 评论 -
第四章-数组
4.1 hu //小朋友#include<stdio.h> int main(){ int n; int i,j; char arr[999],c; scanf("%d%c",&n,&c); for(i=0;i<n;i++) { gets(arr); for(j=0;j<100;j++)原创 2015-12-12 14:29:59 · 452 阅读 · 0 评论 -
第三章-循环语句
3.1 go for it Dao //小朋友#include<stdio.h> nt main(){ int n; double a,b; double num=0,p=0; int i; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%lf%lf",&a,&b); num+=a; p+原创 2015-12-12 14:09:20 · 571 阅读 · 0 评论 -
(第四章里的杨辉大坑系列)
为了证明死蠢的杨辉0代码并不是白写了整个三角窝决定另起一篇博客把杨辉系列扔一起(。 以及第四章的出题人不知道被整个机房被问候了多少次系列(。4.3 yanghui0 //小朋友#include<stdio.h> int arr[50][50]; int arr2[50][50];//scanf int main(){ int n;//有n+1行原创 2015-12-12 14:53:18 · 602 阅读 · 0 评论 -
第二章-判断语句
2.1 一个矩形桌子砍去一角剩下几条边 //小朋友 #include<stdio.h> int main() { int a,b;//桌长宽 int m,n;//砍角长宽 scanf("%d%d",&a,&b); scanf("%d%d",&m,&n); if(a==m&&b==n) printf("3\n"); else if(a==m) printf("4\原创 2015-12-10 19:11:09 · 420 阅读 · 0 评论 -
第一章-简单的顺序程序
1.1 A+B问题 //小朋友: #include<stdio.h> int main() { int a,b; scanf("%d%d",&a,&b); printf("%d",a+b); return 0; } //犇犇: #include<cstdio> int main() { int a,b; scanf("%d%d",&a,&b);原创 2015-12-10 18:23:20 · 428 阅读 · 0 评论 -
第六章-数据结构入门
6.1 forest #include<iostream> #include<stdio.h> #include<string> #include<algorithm> using namespace std; struct person { int number; int streng;//体力 int seat;//站位 }pe原创 2016-04-24 07:09:20 · 2231 阅读 · 0 评论