自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(148)
  • 资源 (1)
  • 问答 (1)
  • 收藏
  • 关注

原创 PAT乙级别_1071 小赌怡情 (15 分)

这题太坑爹了。注意空格。实际上程序运行时测试点里输、赢 和 筹码不够 的Total前都有两个空格。Win 100! Total = 200.//注意这里Total前有2个空格Lose 50. Total = 150.//注意这里Total前有2个空格Not enough tokens. Total = 150.//注意这里Total前有2个空格 Game Over.这中间只...

2019-01-13 19:42:57 292

原创 PATB级-1091 N-自守数 (15 分)

 题目链接解题思路构造一个判断自守数的函数isZS(int k, int nkk)如果k==n*k*k,则k是自守数。如果k!=n*k*k,分别用10,100,1000,。。。对n*k*k取模,求出末尾1,2,3...位,如果等于k,则k是自首数字 我的代码#include <iostream>#include<algorithm>#inc...

2019-01-11 10:01:17 488

原创 Dev-c++下'stoi' was not declared in this scope解决办法

在Dev-c++软件写C++程序时使用stoi()函数时出现[Error] 'stoi' was not declared in this scope。解决办法:在“编译选项”里,选择 语言标准为"ISO C++11"标准即可具体步骤:点击“工具[T]”,再点击“编译选项[C]”,出现下图:再点"代码生成/优化",再点"代码生成",再点"语言标准",选择"ISO C++11...

2019-01-10 21:05:47 20706 12

原创 PAT_乙级_1076. Wifi密码 (15)

下面是微博上流传的一张照片:“各位亲爱的同学们,鉴于大家有时需要使用wifi,又怕耽误亲们的学习,现将wifi密码设置为下列数学题答案:A-1;B-2;C-3;D-4;请同学们自己作答,每两日一换。谢谢合作!!~”—— 老师们为了促进学生学习也是拼了…… 本题就要求你写程序把一系列题目的答案按照卷子上给出的对应关系翻译成wifi的密码。这里简单假设每道选择题都有4个选项,有且只有1个正确答案。输入...

2018-02-13 22:10:14 409

原创 PAT_乙级_1046. 划拳(15)

划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。输入格式:输入第一行先给出一个正整数N(<=100),随后N行,每行给出一轮划拳的记录,格式为:...

2015-12-06 14:05:09 2321 2

原创 浙江大学PAT_甲级_1094. The Largest Generation (25)

题目链接:点击打开链接A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest po

2015-11-11 12:55:30 1117

原创 浙江大学PAT_甲级_1032. Sharing (25)

题目地址:点击打开链接To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suf

2015-11-06 10:53:50 692

原创 C++邻接矩阵创建图及深度、广度遍历

#include "stdafx.h"#include#includeusing namespace std;#define VERTEX_MAX 26 //图的最大顶点数 #define MAXVALUE 32767 //最大值(可设为一个最大整数) typedef struct //定义邻接矩阵图结构 { char Vertex[VERTEX_MAX]; //保存顶点信

2015-10-27 19:20:46 7328 3

原创 浙江大学PAT_甲级_1063. Set Similarity (25)

题目链接 点击打开链接Given two sets of integers, the similarity of the sets is defined to be Nc/Nt*100%, where Nc is the number of distinct common numbers shared by the two sets, and Nt is the total num

2015-10-02 11:23:29 505

原创 Java创建/遍历二叉树

import java.util.Scanner;import static java.lang.System.*;public class Tree{ class TreeNode { String data; //元素数据 TreeNode left; //左子树结点 TreeNode right; //右子树结点 } static final int MAXLEN

2015-09-16 19:22:32 464

原创 Java parseInt将其它进制整数转换为十进制

import java.util.*;import java.lang.*;import static java.lang.System.*;public class Main { public static void main(String[] args) { int a=Integer.parseInt("657", 8); //将8进制的657转换为10进制变成431

2015-09-14 15:06:15 1463

原创 浙江大学PAT_乙级_1043. 输出PATest(20)

题目链接:点击打开链接给定一个长度不超过10000的、仅由英文字母构成的字符串。请将字符重新调整顺序,按“PATestPATest....”这样的顺序输出,并忽略其它字符。当然,六种字符的个数不一定是一样多的,若某种字符已经输出完,则余下的字符仍按PATest的顺序打印,直到所有字符都被输出。输入格式:输入在一行中给出一个长度不超过10000的、仅由英文字母构成的非空字

2015-09-13 19:52:36 1025

原创 浙江大学PAT_乙级_1042. 字符统计(20)

题目链接:点击打开链接请编写程序,找出一段给定文字中出现最频繁的那个英文字母。输入格式:输入在一行中给出一个长度不超过1000的字符串。字符串由ASCII码表中任意可见字符及空格组成,至少包含1个英文字母,以回车结束(回车不算在内)。输出格式:在一行中输出出现频率最高的那个英文字母及其出现次数,其间以空格分隔。如果有并列,则输出按字母序最小的那个字母。统

2015-09-13 09:36:39 944

原创 浙江大学PAT_乙级_1041. 考试座位号(15)

题目链接:点击打开链接每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。输入格式:输入第一行给出一个正整数N(

2015-09-13 08:30:33 1187

原创 Android 一个简单的计算器APP

apk下载地址:http://pan.baidu.com/s/1dD3513jMainActivity.java文件内容:package netpythontojavaviewmodecontents.csdn.blog.calculator0;import android.app.Activity;import android.os.Bundle;import a

2015-09-11 23:46:54 8976 1

原创 浙江大学PAT_甲级_1047. Student List for Course (25)

题目链接:点击打开链接Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the co

2015-09-08 22:03:13 515

原创 C++记录程序运行时间

#include#include//计时函数头文件using namespace std;int main(){ int i = 0; for (; i <= 10000; i++) { cout << i << endl; } printf("%d ms", clock());//输出运行所费时间,单位毫秒ms system("pause"); return 0;}

2015-09-07 20:13:20 639

原创 浙江大学PAT_甲级_1070. Mooncake (25)

题目链接:点击打开链接Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the regio

2015-09-06 17:05:56 580

原创 浙江大学PAT_甲级_1083. List Grades (25)

题目链接:点击打开链接Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of

2015-09-06 15:19:15 446

原创 浙江大学PAT_甲级_1052. Linked List Sorting (25)

题目链接:点击打开链接A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next

2015-09-06 14:18:07 501

原创 浙江大学PAT_甲级_1062. Talent and Virtue (25)

题目链接:点击打开链接这道题在乙级里出现过。乙级题目程序,点击打开http://blog.csdn.net/pythontojava/article/details/48227349

2015-09-05 18:16:56 455

原创 浙江大学PAT_乙级_1015. 德才论 (25)

题目链接:点击打开链接宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入格式:输入第1行给出3个正整数,分别为:N(5),即考生总数;L(>=60),为录取最低

2015-09-05 18:12:49 1036

原创 Android Studio App AlertDialog使用范例

MainActivity.java内容如下:package yin.alert;import android.app.Activity;import android.app.AlertDialog;import android.content.DialogInterface;import android.os.Bundle;import android.view.View;imp

2015-09-04 19:52:19 4847

原创 Android Studio App启动另一个activity

Android App通过按钮启动另一个activity。1.在activity_main.xml里新建一个按钮:<Button android:id="@+id/button1" android:layout_width="fill_parent" android:layout_height="wrap_content"

2015-09-04 19:25:12 8072

原创 MOOC数据结构-01-复杂度1 最大子列和问题 (20分)

题目链接:点击打开链接给定K个整数组成的序列{ N​1​​, N​2​​, ..., N​K​​ },“连续子列”被定义为{ N​i​​, N​i+1​​, ..., N​j​​ },其中 1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和2

2015-09-03 08:07:28 888

原创 浙江大学PAT_甲级_1071. Speech Patterns (25)

题目链接:点击打开链接People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can help to narr

2015-09-02 19:56:08 451

原创 浙江大学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 format N = p1^k1 * p2^k2 *…*pm^km.Input Specification:Each input file co

2015-09-02 13:47:07 486

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

结构体排序

2015-09-02 10:49:43 405

原创 浙江大学PAT_甲级_1048. Find Coins (25)

题目链接:点击打开链接Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as

2015-09-02 09:01:52 377

原创 PAT_甲级_1029. Median (25)

题目链接:点击打开链接 Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16...

2015-09-01 14:35:06 653 2

原创 Android Studio App LinearLayout多层布局嵌套

LinearLayout内部嵌套LinearLayoutactivity_main.xml内容如下:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_wid

2015-08-30 20:56:15 9575 1

原创 Android Studio App 播放工程内部音乐文件

app播放app工程自带(不是SD卡里的)的音乐文件。1.在工程res文件夹里新建raw文件夹,在raw文件夹里放置一份mp3文件。2.在MainActivity.java文件里public class MainActivity extends Activity下面一行添加: private MediaPlayer mp=new MediaPlayer();3.

2015-08-28 21:08:16 26733 16

原创 Android Studio App EditText获取输入的文字

用aedittext.getText().toString()获取输入的字符串。示范整个activity_mani.xmln内容如下:<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"

2015-08-28 16:33:37 31926 4

原创 Android Studio App设置线性布局LinerLayout控件占屏幕长宽比例

如何设置两个控件在水平方向上的占屏幕的比例?1.要有线性布局LinerLayout2.设置线性布局控件水平排列:android:orientation="horizontal"3.设置第一个控件:android:layout_width="0dp"android:layout_weight="6"第二个控件:android:layout_width="0dp"andro

2015-08-28 15:59:01 16223

原创 Android Studio App设置线性布局LinerLayout控件垂直/水平方向排列

1.线型布局用LinearLayout2.让控件垂直方向排列用android:orientation="vertical"注意此时内部控件不能将高度指定为fill_parent和match_parent,因为这样一个控件就把屏幕垂直方向全部占满了,没有其它控件的空间。垂直方向排列控件的整个xml内容范例如下:<LinearLayout xmlns:android="http:/

2015-08-28 15:26:04 49031

原创 Android Studio App隐藏标题栏

IDE是Android Studio。1.把MainActivity.java文件里的public class MainActivity extends ActionBarActivity改为public class MainActivity extends Activity2.在super.onCreate(savedInstanceState);语句下面添加re

2015-08-27 11:43:46 2024

原创 Android Studio App设置Notification通知

1.在maniactivity.java文件里添加:NotificationManager manager=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);//NotificationManager实例对通知进行管理Notification notification=new Notification(R.drawable

2015-08-25 22:16:17 8848

原创 Android Studio App设置TextView文字内容大小颜色

设置TextView文字内容大小颜色1.第一种方法在activity_main.xml李设置,Java文件不用改:android:text="这里是文字"android:textSize="字体大小"android:textColor="颜色代码"整个xml内容如下:<RelativeLayout xmlns:android="http://schemas.andr

2015-08-21 10:16:10 59398 1

原创 Android Studio App设置Activity背景图片

1.首先PC上要有一张png格式的图片,复制它,注意图片名字(只能含小写字母a~z和数字0~9,".png“要小写),粘贴进drawable文件夹。 2.在activity_main.xml里添加下面一句,注意添加位置,/drawable/+图片名称。 android:background="@drawable/backimg"整个activity_main.xml内...

2015-08-21 08:42:33 64094 6

原创 Android Studio Toast/Notification中文乱码解决办法

在build.grade (Modul: app)文件里添加一面一句:android{compileOptions.encoding="GBK"}整个build.grade (Modul: app)内容如下:apply plugin: 'com.android.application'android { compileSdkVersion 22 buildToolsVe

2015-08-19 21:51:04 5031 1

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除