原创 浙江大學PAT_甲級_1048. Find Coins (25)

題目鏈接:點擊打開鏈接 Eva loves to collect coins from all over the universe, including some other planets like Mars. One day s

原创 Android Studio App EditText獲取輸入的文字

用aedittext.getText().toString() 獲取輸入的字符串。 示範 整個activity_mani.xmln內容如下: <Li

原创 浙江大學PAT_乙級_1015. 德才論 (25)

題目鏈接:點擊打開鏈接 宋代史學家司馬光在《資治通鑑》中有一段著名的“德才論”:“是故才德全盡謂之聖人,才德兼亡謂之愚人,德勝才謂之君子,才勝德謂之小人。凡取人之術,苟不得聖人,君子而與之,與其得小人,不若得愚人。” 現給出一批考生

原创 PAT_甲級_1029. Median (25)

題目鏈接:點擊打開鏈接   Given an increasing sequence S of N integers, the median is the number at the middle position. For exampl

原创 Android Studio App AlertDialog使用範例

MainActivity.java內容如下: package yin.alert; import android.app.Activity; import android.app.AlertDialog; import android.

原创 JSTL標籤的用法示例

1.把jstl.jar和standard.jar文件複製,粘貼進項目lib文件夾。 2.新建use.jsp文件,jsp代碼如下: <%@ page language="java" contentType="text/html; cha

原创 MOOC數據結構-01-複雜度1 最大子列和問題 (20分)

題目鏈接:點擊打開鏈接 給定K個整數組成的序列{ N​1​​, N​2​​, ..., N​K​​ },“連續子列”被定義爲{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1≤i≤j≤K。“最大子列和”則被定義

原创 Android Studio App設置Activity背景圖片

1.首先PC上要有一張png格式的圖片,複製它,注意圖片名字(只能含小寫字母a~z和數字0~9,".png“要小寫),粘貼進drawable文件夾。   2.在activity_main.xml裏添加下面一句,注意添加位置,/draw

原创 浙江大學PAT_甲級_1059. Prime Factors (25)

題目鏈接:點擊打開鏈接 Given any positive integer N, you are supposed to find all of its prime factors, and write them in the fo

原创 Android Studio App設置TextView文字內容大小顏色

設置TextView文字內容大小顏色 1.第一種方法在activity_main.xml李設置,Java文件不用改: android:text="這裏是文字" android:textSize="字體大小" android:textCo

原创 浙江大學PAT_甲級_1071. Speech Patterns (25)

題目鏈接:點擊打開鏈接 People often have a preference among synonyms of the same word. For example, some may prefer "the police"

原创 浙江大學PAT_甲級_1055. The World's Richest (25)

題目鏈接:點擊打開鏈接 Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world's

原创 Android Studio App啓動另一個activity

Android App通過按鈕啓動另一個activity。 1.在activity_main.xml裏新建一個按鈕: <Button android:id="@+id/button1" android:l

原创 Android Studio App設置Notification通知

1.在maniactivity.java文件裏添加: NotificationManager manager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);//No

原创 Android Studio App設置線性佈局LinerLayout控件垂直/水平方向排列

1.線型佈局用LinearLayout 2.讓控件垂直方向排列用 android:orientation="vertical"注意此時內部控件不能將高度指定爲fill_parent和match_parent,因爲這樣一個控件就把屏幕垂直