PIXNET Logo登入

骷骷的筆記

跳到主文

因為骷骷太健忘,所以要記下來……。

部落格全站分類:心情日記

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 10月 21 週一 201318:47
  • 可愛的冷笑話


今天吃早餐的時候,看到飲料的杯子上有個有趣的問題,
 
問:怎麼使麻雀安靜下來?
 
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(519)

  • 個人分類:有趣
▲top
  • 8月 29 週四 201323:16
  • 使用 firefox 的 google 搜尋引擎做運算

cal.jpg
▼firefox 的 google 搜尋引擎有計算器的效果。
 
====================
次方可以用 ^ 符號,
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(67)

  • 個人分類:驚訝
▲top
  • 8月 23 週五 201318:10
  • 國一數學


題目連結:[中學] 請問一題國一數學
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

public class Test{

public static void main(String[] args) {

int abcd=0;
do{
int ab=choose(abcd, 0, 1);
int cd=choose(abcd, 2, 3);
int ad=choose(abcd, 0, 3);
int cb=choose(abcd, 2, 1);
int bcad=choose(abcd, 1, 2)*100+ad;

if((ab*cd)==bcad&&(ad*cb)==abcd){

System.out.println(ab+"*"+cd+"="+bcad);
System.out.println(ad+"*"+cb+"="+abcd);
System.out.println(abcd);
System.out.println("=====");
}

abcd++;
}while(abcd<10000);
}

static int choose(int abcd, int i, int j){

int ten=0, one=0;
i=3-i;
j=3-j;
for(int k=0;k<=i||k<=j;k++){

if(k==i){

ten=10*(abcd%10);
}

if(k==j){

one=(abcd%10);
}

abcd/=10;
}

return ten+one;
}
}
/*輸出結果:
0*0=0
0*0=0
0
=====
21*87=1827
27*81=2187
2187
=====
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(181)

  • 個人分類:JAVA
▲top
  • 8月 08 週四 201315:56
  • 國中數學


原問題網址:[中學] 求助!有關幾何的

==========
回文中已經有人解出來,
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(363)

  • 個人分類:好奇
▲top
  • 8月 02 週五 201316:10
  • 大地遊戲(排列組合)


題目連結:[其他] 大地遊戲(排列組合) 急.1000P徵
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

public class Test{

static int[][] t=new int[6][12];

public static void main(String[] args) {

//initial t[0].
for(int i=0;i<12;i++){

t[0][i]=11-i;
}

next(0);
}

static void next(int ti){

//start next
while(!check(ti)){

if(isMax(ti)){

if(ti==5){

System.out.println("End.");
return;
}

next(--ti);
return;
}

add(ti);
}

ti++;
//print answer.
if(5<ti){

print();

add(5);
next(5);
return;
}

copyRow(ti);
next(ti);
}

static String iToS(int i){
String s=null;

switch (i) {
case 0:
s="A1";
break;
case 1:
s="B1";
break;
case 2:
s="C1";
break;
case 3:
s="D1";
break;
case 4:
s="A2";
break;
case 5:
s="B2";
break;
case 6:
s="C2";
break;
case 7:
s="D2";
break;
case 8:
s="A3";
break;
case 9:
s="B3";
break;
case 10:
s="C3";
break;
case 11:
s="D3";
break;
default:
break;
}

return s;
}

static void print(){

System.out.println("\t第一關"+"\t第二關"+"\t第三關"+"\t第四關"+"\t第五關"+"\t第六關");
for(int i=0;i<6;i++){

System.out.print("時段"+(i+1)+"\t");
for(int j=0;j<6;j++){

System.out.print(iToS(t[i][2*j])+iToS(t[i][2*j+1])+"\t");
//System.out.print(t[i][2*j]+"-"+t[i][2*j+1]+"\t");
}
System.out.println();
}
System.out.println("==========");
}

//t[ti] next permutation.
static void add(int ti){

int i=-1;
int j=1;

while(t[ti][j-1]<t[ti][j]){

j++;
}

for(int k=0;k<j;k++){

if(t[ti][k]>t[ti][j]){

if(i==-1){

i=k;
}else if(t[ti][k]<t[ti][i]){

i=k;
}
}
}

change(ti,i,j);
maxToMin(ti, 0, j-1);
}

static void maxToMin(int ti, int i, int j){

for(int k=i;k<j;k++){

for(int z=k+1;z<=j;z++){

if(t[ti][k]<t[ti][z]){

change(ti,k,z);
}
}
}
}

static void change(int ti, int i, int j){

int k=t[ti][i];
t[ti][i]=t[ti][j];
t[ti][j]=k;
}

static void copyRow(int ti){

//copy t[ti-1] to t[ti].
for(int i=0;i<12;i++){

t[ti][i]=t[ti-1][i];
}
}

static boolean isMax(int ti){

//check is it max
boolean b=true;
for(int i=0;i<12;i++){

if(t[ti][i]!=i){

b=false;
break;
}
}

return b;
}

static boolean check(int ti){

boolean b=true;
for(int i=0;i<6;i++){

//check row condition.
if(t[ti][2*i]<t[ti][2*i+1] || (t[ti][2*i+1]-t[ti][2*i])%4==0){
//if((t[ti][2*i+1]-t[ti][2*i])%4==0){

b=false;
return b;
}

//check column is only one.
for(int j=ti-1;j>=0;j--){

if(t[ti][2*i]==t[j][2*i] || t[ti][2*i]==t[j][2*i+1] || t[ti][2*i+1]==t[j][2*i] || t[ti][2*i+1]==t[j][2*i+1]){

b=false;
return b;
}
}
}

//check row is only one.
for(int i=0;i<10;i++){

for(int j=i+1;j<12;j++){

if(t[ti][i]==t[ti][j]){

b=false;
return b;
}
}
}

return b;
}
}
/*輸出結果:
第一關 第二關 第三關 第四關 第五關 第六關
時段1 D3C3 B3A3 D2C2 B2A2 D1C1 B1A1
時段2 B3A3 D3C3 B2A2 D2C2 B1A1 D1C1
時段3 D1C1 B1A1 D3C3 B3A3 D2C2 B2A2
時段4 B1A1 D1C1 B3A3 D3C3 B2A2 D2C2
時段5 D2C2 B2A2 D1C1 B1A1 D3C3 B3A3
時段6 B2A2 D2C2 B1A1 D1C1 B3A3 D3C3
==========
End.
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(1,419)

  • 個人分類:JAVA
▲top
  • 7月 10 週三 201315:56
  • 如何在 word 中,快速打出 "…" 省略符號。

ddd1
想要在 word 中快速打出 "…" 符號,只要使用快捷鍵就可以了,預設的快捷鍵是 Ctrl + Alt + .
上面所說的 "." 的位置是上面有 ">" 的那個鍵。
千萬不要按到 有 "Del" 的那個鍵,不然會變成 Ctrl + Alt + Del,會發生很可怕的事喲!
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(2,603)

  • 個人分類:驚訝
▲top
  • 6月 17 週一 201321:45
  • JAVA 覆寫回傳值


JAVA 覆寫回傳值
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

class A{

public void print(){
System.out.println("A");
}
}
class B extends A{

public void print(){
System.out.println("B");
}
}

class F{

public A get(){
return new A();
}
}

class S extends F{

public B get(){
return new B();
}
}

//編譯會不通過
//class SS extends S{
//
// public A get(){
// return new A();
// }
//}

class SS2 extends S{

public B get(){
return (B) new A();
}
}

public class Test{

public static void main(String[] args) {

new F().get().print();
new S().get().print();

SS2 notGood=new SS2();

//編譯沒問題,但是執行會出錯
//notGood.get();
}
}
/*輸出結果:
A
B
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(499)

  • 個人分類:JAVA
▲top
  • 6月 15 週六 201301:29
  • JAVA 的強制轉型


JAVA 的強制轉型
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

class OneMethod{

public void one(){

System.out.println("a");
}
}

class TwoMethod extends OneMethod{

public void one(){

System.out.println("b");
}

public void two(){

System.out.println("c");
}
}

public class Test{

public static void main(String[] args) {

OneMethod t=new TwoMethod();
t.one();
((TwoMethod)t).two();

System.out.println("=====");

int a=(int) 123L;
System.out.println(a);
long b=123;
System.out.println(b);
}
}
/*輸出結果:
b
c
=====
123
123
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(1) 人氣(9,781)

  • 個人分類:JAVA
▲top
  • 6月 14 週五 201312:17
  • JAVA 的 String 是不可改變的


JAVA 的 String 是不可改變的
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

public class test {

public static void main(String[] args) {

String a="test";
String b=a;
System.out.println(a==b);
a+="a";
System.out.println(a==b);
b+="a";
System.out.println(a==b);
System.out.println(a);
System.out.println(b);

System.out.println("=====");

Integer i=123;
Integer j=i;
System.out.println(i==j);
i+=4;
System.out.println(i==j);
j+=4;
System.out.println(i==j);
System.out.println(i);
System.out.println(j);

System.out.println("=====");

i=123;
j=i;
System.out.println(i==j);
i+=5;
System.out.println(i==j);
j+=5;
System.out.println(i==j);
System.out.println(i);
System.out.println(j);
}
}
/*輸出結果:
true
false
false
testa
testa
=====
true
false
true
127
127
=====
true
false
false
128
128
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(156)

  • 個人分類:JAVA
▲top
  • 6月 14 週五 201310:53
  • JAVA的==運算子和.equals()方法


JAVA的==運算子和.equals()方法
JAVA 程式碼
//作者:骷骷
//網誌:http://bekachu.pixnet.net/blog

public class test {

public static void main(String[] args) {

String a="test";
String b="test";
String c=new String("test");
System.out.println(a==b);
System.out.println(a.equals(b));
System.out.println(b==c);
System.out.println(b.equals(c));

System.out.println("=====");

Integer i=123;
Integer j=123;
Integer k=new Integer(123);
System.out.println(i==j);
System.out.println(i.equals(j));
System.out.println(j==k);
System.out.println(j.equals(k));
}
}
/*輸出結果:
true
true
false
true
=====
true
true
false
true
*/
(繼續閱讀...)
文章標籤

骷骷 發表在 痞客邦 留言(0) 人氣(5,012)

  • 個人分類:JAVA
▲top
12...4»

BloggerAds

BlogAD

文章分類

  • 殘酷 (1)
  • JAVA (14)
  • 好奇 (2)
  • 遺忘 (2)
  • 有趣 (2)
  • 認真 (4)
  • 驚訝 (5)
  • 無奈 (1)
  • 懶惰 (6)
  • 未分類文章 (1)

最新文章

  • 可愛的冷笑話
  • 使用 firefox 的 google 搜尋引擎做運算
  • 國一數學
  • 國中數學
  • 大地遊戲(排列組合)
  • 如何在 word 中,快速打出 "…" 省略符號。
  • JAVA 覆寫回傳值
  • JAVA 的強制轉型
  • JAVA 的 String 是不可改變的
  • JAVA的==運算子和.equals()方法

文章精選

文章搜尋

參觀人氣

  • 本日人氣:
  • 累積人氣: