随笔分类 -  数学之美

数字,质数,合数,奇术,偶数,
摘要:1 #include 2 3 #include 4 5 using namespace std; 6 7 8 9 inline int compare(string str1, string str2) 10 11 { 12 13 if(str1.size()... 阅读全文
posted @ 2015-05-25 16:44 zach96 阅读(203) 评论(0) 推荐(0)
摘要:PAT 2-07 素因子分解(C语言实现)PAT 2-07 素因子分解(C语言实现),有需要的朋友可以参考下。题目说明:给定某个正整数N,求其素因子分解结果,即给出其因式分解表达式 N = p1^k1* p2^k2*…*pm^km。输入格式说明:输入longint范围内的正整数N。输出格式说明:按给... 阅读全文
posted @ 2015-01-10 20:33 zach96 阅读(2294) 评论(0) 推荐(0)
摘要:#includeint f1(int i){ if (i =n) { a[k]=m%n; m=m/n; k++; } a[k]=m; int b[100]; for(int i=k; k>=0; k--) { ... 阅读全文
posted @ 2015-01-10 17:25 zach96 阅读(152) 评论(0) 推荐(0)
摘要:#includeint main(){ int n,m,s,i; scanf("%d",&n); for(m=2;m<n;m++) { s=0; for(i=1;i<m;i++) if((m%i)==0) s=s+i; ... 阅读全文
posted @ 2015-01-09 19:02 zach96 阅读(109) 评论(0) 推荐(0)
摘要:#includestatic int arr[100];void main(){ void solve(int people,int spacing); int people,spacing,i,j=0; printf("请输入总人数(2-99):"); scanf("%d",&people); p... 阅读全文
posted @ 2015-01-09 19:01 zach96 阅读(144) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std;int arry[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};bool is_bisse(int year){ if((year % 4 == 0 && ... 阅读全文
posted @ 2015-01-09 18:59 zach96 阅读(159) 评论(0) 推荐(0)
摘要:#include int main(){ int n,i; int a[45]={2,3}; scanf("%d",&n); for (i=2;iusing namespace std;int main(){ int i; __int64 n,fib[45] = ... 阅读全文
posted @ 2015-01-09 18:57 zach96 阅读(412) 评论(0) 推荐(0)
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 #define mod 1003 6 7 int quick_power(int a, int b) 8 { 9 if(a == 0) return 0;10 int ret... 阅读全文
posted @ 2015-01-09 18:54 zach96 阅读(135) 评论(0) 推荐(0)
摘要:#include #include int main(){ char a[101],b[101]; int i,j,k,cas,count=1,num2,num3; scanf("%d",&cas); getchar(); while (cas--) { ... 阅读全文
posted @ 2015-01-09 18:53 zach96 阅读(126) 评论(0) 推荐(0)
摘要:#include#includeusing namespace std;long long a[1000001];char c[1000001];int main(){ int i=2; cin>>a[1]; int ans=0; while(scanf("%c",&c[i++])!=EOF) s... 阅读全文
posted @ 2015-01-09 18:52 zach96 阅读(135) 评论(0) 推荐(0)
摘要:注意:只有一个鞍点可证#includeint main(){ int i,j,k,max,maxj,flag; //int a[3][4]={{1,2,3,4},{5,6,7,8},{9,10,11,12} }; int a[3][4]={{1,2,3,13},{5,6,8,7},... 阅读全文
posted @ 2015-01-09 18:51 zach96 阅读(156) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std;#define maxn 100010struct N{ int l, r, max;} tree[maxn * 3]; //注意乘三int num[maxn];void build(int node... 阅读全文
posted @ 2015-01-09 18:44 zach96 阅读(223) 评论(0) 推荐(0)
摘要:#include #include void process(int b[10][10],int m){ int i,j,k; i=0,j=m/2; b[i][j]=1; for(k=2;k=m)) {i+=2;j--;} if (i=m) j=0; if (b[i][j]!=0) {i+=2;j... 阅读全文
posted @ 2015-01-09 18:41 zach96 阅读(282) 评论(1) 推荐(0)
摘要:#include void main(){ int i,j,k,N,count; int data[20][20]={0}; printf("Input an integer N:"); scanf("%d",&N); //count=0; count=N*N; for(k=0;kk;i--) ... 阅读全文
posted @ 2015-01-09 18:38 zach96 阅读(355) 评论(0) 推荐(0)