Skip to content

Instantly share code, notes, and snippets.

@okok897
okok897 / 設n個整數,求整數數列區間[L,R]中第K大的數值,若不存在第K大則輸出最小值
Created September 18, 2016 16:38
設n個整數,求整數數列區間[L,R]中第K大的數值,若不存在第K大則輸出最小值.c
#include <iostream>
using namespace std;
main() {
int n;
while(cin>>n){ //輸入n個數字
int a[n];
for(int i = 0 ; i < n ; ++i){
cin >>a[i]; //輸入數列
}
@okok897
okok897 / 找出數列中最小的子數列.cpp
Last active September 15, 2016 16:39
找出數列中最小的子數列
//尋找輸入n個數字數列中 加起來最小的子數列
#include <iostream>
using namespace std;
int main() {
int n;
while(cin>>n){
int a[n];
int startflag=0,endflag=0;
for(int i = 0 ; i < n ; i += 1){ //輸入數列
#include <stdio.h>
#include <stdlib.h>
int main()
{
int l,M=3,i,j=0,num[10]={0};
char array[16];
printf("請輸入幾組數字:\n");
scanf("%d",&M);
@okok897
okok897 / gist:7a5723784fa0550465cb
Last active August 29, 2015 14:23
8051 七段+按鈕v002
#include <reg51.h> //8051?????
#define seg7 P1
#define segs P2
#define PB P0
void scanner(int);
void delay(int); //?????????
int flag;
char seg[10]={0xc0,0xf9,0xa4,0xb0,0x99, //????????