Zerojudge 基礎題庫a001 哈囉 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 - 12月 14, 2019 基本上,只要記得加重複測資即可(while(){}) 程式碼: 1 2 3 4 5 6 7 8 #include <iostream> using namespace std; int main(){ string a; while( cin >> a) cout << "hello, " << a << endl; } 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 留言
Zerojudge 基礎題庫a004 文文的求婚 (Python) - 1月 22, 2020 西元年被4整除且不被100整除,或被400整除者即為閏年 => year % 4 == 0 and year % 100 != 0 or year % 400 == 0 如果是True就是閏年 False 則是平年 對!就這樣~ Python 程式碼: 1 2 3 4 5 6 7 8 9 10 while 1 : try : x = int ( input ()) except : break if x % 4 == 0 and x % 100 != 0 or x % 400 == 0 : print ( "閏年" ) else : print ( "平年" ) 閱讀完整內容
Zerojudge 基礎題庫a002 簡易加法 - 12月 31, 2019 這題簡單,不多做說明。 記得重複測資,詳細請參考基礎題庫a001的範例程式碼。 程式碼: 1 2 3 4 5 6 7 8 9 10 11 12 #include <iostream> using namespace std; int main () { //input two number; int inputA,inputB; while (cin >> inputA >> inputB) { cout << inputA + inputB << endl; } } 閱讀完整內容
Zerojudge 基礎題庫a021 大數運算(Python) - 2月 02, 2020 eval()真是太好用了~ 只是要排除除法的問題有點煩,Python好棒! 程式碼: 1 2 3 4 5 6 7 8 9 10 11 12 while 1 : try : x = input () except : break y = x . split() if y[ 1 ] == "/" : print ( int (y[ 0 ]) // int (y[ 2 ])) else : print ( eval (x)) 閱讀完整內容
留言
張貼留言