原创 2/1+3/2+5/3+8/5....前二十項和

#include<stdio.h> int main() { double i=1.0,j=2.0,sum=0.0; int n=0; for(n=1;n<=20;n++) { sum=j/i+sum; j=i+j;

原创 Linux中Python設置默認版本

首先你需要有多個版本 ? cd /usr/bin rm python ln -s pythonx.xm python x.x爲你想要的版本

原创 如何在多個python版本下將默認版本

首先你需要有多個版本 😛 cd /usr/bin rm python ln -s pythonx.xm python x.x爲你想要的版本

原创 輸出字符串的 數字部分

#include<stdio.h> double my_atoi(char *str) //可實現任意字符串的操作(也許還有部分情況未想到,望評論。) { double i=0.0; dou

原创 輸入數字各位的總和

#include<stdio.h>     int Digitsum(int n)   {       if(n>9)       return n%10+Digitsum(n/10);      //求餘計算最後一位的值,除法使最後一

原创 Faster 配置中的問題

記錄一下在配置Faster時遇到的問題,方便你我他 ** 無法打開libcudnn.so.5 ** sudo sh -c "echo '/usr/local/cuda/lib64\n/usr/local/cuda/lib' >>/et

原创 不建立臨時變量 交換兩個數字

//異或法 #include<stdio.h> int main() { int a,b; scanf("%d,%d",&a,&b); a=a^b; b=a^b; a=a^b; printf("%d,%d\n",a,b);

原创 strcat函數

#include<stdio.h> #include<assert.h> char my_strcat(char *dest ,char * src) { assert((*dest!=NULL)&&(*src!=NULL));//

原创 n的k次方

#include<stdio.h> int Mi(int n,int k) { if(k) return n*Mi(n,k-1); return 1; //遞歸停止時返回的值 } int main() { int

原创 10個數求最大

#include<stdio.h> main() { int i,j,max,a[9]; for(i=0;i<10;i++) {scanf("%d",&a[i]);} for(j=0;j<10;j=j+2) { if(a[

原创 strrchr【該怎麼用char 。T_T】

#include <stdio.h> int *strrchr(char const *str, int ch ) //原本這個函數的類型是char 但是考慮返回值因爲要計數所以改成int { int count=1; w

原创 最大公約數

#include <stdio.h> int fun(int a,int b) { int c; if((c=a%b)==0) // 如果可以直接相除 除數就是最大公約數。 return b; else

原创 順序表 簡單功能

//SeqList.h #ifndef _SEQLIST_H #define _SEQLIST_H #include<iostream> #include<assert.h> #include<stdlib.h> using names

原创 1-1/2+1/3- …… -1/100

#include <stdio.h> #include <math.h> int main() { int n=0,S=0; double sum=0,M=0; for(n=1;n<=100;n++) { S=pow(

原创 strcpy函數

#include<stdio.h> char *m_strcpy(char *a, char* b) { while(*b!='\0') { *a =*b ; a++; b++; } return a; } in