原创 輸出所有符合a^3=b^3+c^3+d^3的數

#include<bits/stdc++.h> using namespace std; int main() { int a,b,c,d; for(a=6;a<201;a++)//cube最小爲6,因爲abc最小爲2;

原创 hdu1379關於map,pair的運用

#include<bits/stdc++.h> using namespace std; bool cmp(pair<string, int>&a,pair<string, int>&b){ return a.second<b.

原创 字符串 hdu1062

#include<bits/stdc++.h> using namespace std; int main(){ int n; while(~scanf("%d",&n)){ getchar();

原创 多線程(Thread繼承,Runnable接口,callable接口)

Thread繼承 package java1; class MyThread extends Thread{//線程的主體類 private String title; public MyThread(String title

原创 map進行字典序排序

#include<iostream> #include<string> #include<stdio.h> #include<map> using namespace std; int main() { map<string,i

原创 多線程(線程同步處理)

class MyThread implements Runnable{ private int ticket = 100; public synchronized boolean sale() {//同步方法,資源 if(thi

原创 線程常用操作方法(線程命名,線程休眠,線程中斷,線程禮讓,線程優先級)

線程命名 package java1; import java.util.concurrent.ExecutionException; class MyThread implements Runnable{ public

原创 四則運算,計算分數,寫入文件

#include<stdio.h> #include<stdlib.h> int main() { FILE *fp; fp=fopen("exam.txt","w"); if(!fp) exit(0); int op,r

原创 從海量數據中尋找某一學生,並更改其成績(運用二分查找法,文件定位)

#include<stdio.h> #include<stdlib.h> #include<string.h> struct student { int num; char name[20]; int score; }t; in

原创 void的初應用

#include<stdio.h> #include<string.h> #include<stdlib.h> void* memcpy(void *a,void*b,unsigned int n) { char*pa =(char*

原创 hduoj 1969 pie(二分法)

My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of var

原创 電燈開關問題

#include<stdio.h> int main() { int i,n,j; while(~scanf("%d",&n)) { int a[101]={0}; while(n--) { scanf("%d"