屍體的身份不明。……不,那狀態沒辦法確認其身份。
遺體少了頭部,四肢和胴體被分割成五塊。
據說那全身的皮膚都被剝掉,所到之處皆可確認有受到殘酷拷問的痕跡。
不只如此,腹部被銳利的刀子劃開,體內的臟器整個拉了出來。
吸血鬼騎士看完勒
果然可憐的李土也成為鋪梗鋪太久結果要完結了只好草草讓他領便當的一面之緣魔王勒
一槍就被over啦
話說我寒蟬格鬥改玩了一下後感覺好沒目標喔
也未免太容易玩膩了吧
還是快快樂樂的去體驗原作吧~
話說空之境界不知為啥不想看耶XDD
﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍﹍
久違的習題阿
而且這題目還真有親切感耶
第一題之前寫過不在寫了
第二題:寫一個方法 比較兩數傳回大的值 和 傳回陣列中最大的值
程式碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static int getmax2(int x, int y)
{
if (x > y) { return (x); } else return (y);
}
static object getarray(ArrayList a)
{
a.Sort();
a.Reverse();
return (a[0]);
}
static void Main(string[] args)
{
ArrayList a = new ArrayList() ;
int x, y;
Console.WriteLine ("輸入兩個數來比大小: ");
x = int.Parse (Console.ReadLine());
y = int.Parse(Console.ReadLine());
Console.WriteLine("比較大的為: " + getmax2(x, y));
Console.Write("輸入要比較大小有幾個數: ");
x =int.Parse ( Console.ReadLine());
for (int i = 1; i <= x; i++)
{
Console.WriteLine ("請輸入第{0}個數: ", i);
a.Add(int.Parse(Console.ReadLine()));
}
Console.WriteLine("其中的最大值為: "+getarray(a));
Console.ReadLine();
}
}
}
第三題
傳回兩數的最大公因數
首先我先自首
我老早忘記要怎麼求公因數勒(當然是只電腦用的方法)
不過還好Google會教我用輾轉相除法
程式碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static int ans(int x, int y)
{
if (x % y != 0) { return ans(y, x % y); }
else return (y);
}
static void Main(string[] args)
{
while (true)
{
int x, y;
Console.WriteLine("請輸入兩個數: ");
x = int.Parse(Console.ReadLine());
y = int.Parse(Console.ReadLine());
int i;
if (y > x)
{
i = x;
x = y;
y = i;
}
Console.WriteLine("兩數的最大公因數為: " + ans(x, y));
}
}
}
}
第四題
讓電腦開大樂透獎一千次最後統計1000次大樂透開獎號碼的開出次數
程式碼(這題突然中邪弄好久喔)
而且寫得很爛
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
bool b = true ;
Random r = new Random();
int[] asd = new int[6];
int i, j,x ;
int[] w = new int[50];
for (i = 1; i <= 1000; i++)
{
Console.Write("第{0}開獎號碼: ",i);
asd[0] = r.Next(1, 50);
w[asd[0]] += 1;
Console.Write(asd[0] + " ");
for (j = 1; j <= 5; j++)
{
b = true;
while (b)
{
b = false;
asd[j] = r.Next(1, 50);
for (x = 0; x < j; x++)
{
if (asd[j] == asd[x]) { b = true ; break; }
}
}
w[asd[j]] += 1;
Console.Write(asd[j]+" ");
}
Console.WriteLine();
}
Console.WriteLine("統計出爐!! ");
for (i = 1; i <= 49; i++)
{
Console.WriteLine("號碼{0}總共開出{1}次", i, w[i]);
}
Console.ReadLine ();
}
}
}
第5題
寫一個能輸入1~n其中所有質數的方法
(這題我好像寫過囧不過為了練習一下我把判斷質數的獨立成一個方法了)
為了方便看我還是搞了好久囧
程式碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static int x(int a,int t)
{
bool b = true;
for (int j = 2; j < a; j++)
{
if (a % j == 0 ) { b = false; break; }
}
if (b)
{
Console.Write(a + " ");
t += 1;
if (t == 10) { Console.WriteLine(); return (0); }
else return (t);
}
else return (t);
}
static void Main(string[] args)
{
int t = 0;
int a;
while (true)
{
Console.Write("輸入n值印出1~n的質數: ");
a = int.Parse(Console.ReadLine());
for (int i = 2; i <= a; i++)
{
t= x(i,t);
}
Console.WriteLine();
}
}
}
}
第6題
撰寫一個方法找資料
(話說為啥要特地用一個方法勒不了阿囧)
話說我看不太懂題目到底想怎樣輸出勒??
程式碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace ConsoleApplication1
{
class Program
{
static void s(ArrayList a, string x)
{
a.Sort();
if (a.BinarySearch(x) > 0) Console.WriteLine("您想找得東西在陣列{0}位置", a.BinarySearch(x));
else Console.WriteLine("啥都沒找到!");
}
static void Main(string[] args)
{
string x;
ArrayList a = new ArrayList();
while (true)
{
Console.Write("輸入您想再我設的陣列裡找得東西吧ㄎㄎㄎ: ");
x = Console.ReadLine();
for (int i = 0; i <= 100; i++)
{
a.Add(i.ToString());
}
s(a, x);
}
}
}
}
XDDDD就這樣啦
反正這種沒測資的題目
大概意思過就行了吧
___________________________________________
沒有想去的地方
沒有要回的歸宿
一邊隨意漂流一邊等待結局是嗎?
我已經等了好久
沒有留言:
張貼留言