摘要: 代码:zujian.javapublic class zujian{ public static void main(String args[]){ ComponentInWindow win = new ComponentInWindow(); win.setBounds(100,100,310,260); win.setTitle("常用组件"); }}ComponentInWindow.javaimport java.awt.*;import javax.swing.*;public class ComponentInWindow extends JFrame{ JT 阅读全文
posted @ 2013-05-28 22:52 同学少年 阅读(474) 评论(0) 推荐(0) 编辑
摘要: 代码:caidan.javapublic class caidan{ public static void main(String args[]){ WindowMenu win = new WindowMenu("带菜单的窗口",20,30,200,190); }}WindowMenu.javaimport javax.swing.*;import java.awt.event.InputEvent;import java.awt.event.KeyEvent;import static javax.swing.JFrame.*;public class WindowMe 阅读全文
posted @ 2013-05-28 22:50 同学少年 阅读(895) 评论(0) 推荐(0) 编辑
摘要: 代码:import javax.swing.*;import java.awt.*;public class chuangkou{ public static void main(String args[]) { JFrame window1 = new JFrame("第一个窗口"); JFrame window2 = new JFrame("第二个窗口"); Container con = window1.getContentPane(); con.setBackground(Color.yellow); window1.setBounds(60,1 阅读全文
posted @ 2013-05-28 22:45 同学少年 阅读(254) 评论(0) 推荐(0) 编辑
摘要: 题目描述Identifier is an important concept in the C programming language. Identifiers provide names for several language elements, such as functions, variables, labels, etc.An identifier is a sequence of characters. A valid identifier can containonly upper and lower case alphabetic characters, underscor 阅读全文
posted @ 2013-05-26 12:16 同学少年 阅读(176) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.InputThe first line of the input contains an integer T(1#include using namespace std;int main(){ char x[1001],y[1001];//用来存放输入的两个数,第一个大数存在x里面,第二个大数存在y里面 int xx[1001]={... 阅读全文
posted @ 2013-05-22 22:00 同学少年 阅读(200) 评论(0) 推荐(0) 编辑
摘要: Problem Description求A^B的最后三位数表示的整数。说明:A^B的含义是“A的B次方”Input输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1using namespace std;int main(){ int x,y,i; int m=1; while(cin>>x>>y&&x&&y) { for(i=0;i<y;i++) { m=m*x; m=m%1000;//因为只关心最后三位,所以每次都把得到的结果取最后三位与下一个m相乘 } ... 阅读全文
posted @ 2013-05-21 15:07 同学少年 阅读(277) 评论(0) 推荐(0) 编辑
摘要: 题目描述Saya and Kudo go shopping together.You can assume the street as a straight line, while the shops are some points on the line.They park their car at the leftmost shop, visit all the shops from left to right, and go back to their car.Your task is to calculate the length of their route.输入The input 阅读全文
posted @ 2013-05-21 14:54 同学少年 阅读(281) 评论(0) 推荐(0) 编辑
摘要: Problem DescriptionWe all love recursion! Don't we?Consider a three-parameter recursive function w(a, b, c):if a 20 or b > 20 or c > 20, then w(a, b, c) returns:w(20, 20, 20)if a using namespace std;int main(){ int w[21][21][21];//要比20大 int i,j,k; for(i=0;i>a>>b>>c&& 阅读全文
posted @ 2013-05-21 14:37 同学少年 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 问题描述:输入多组数据,输出其二进制的形式,以输入0 结束程序。解法:循环。用一个数组来存放每次运算的余数,每次运算指的是被除数 除以 2 ,每得到一个余数就放到数组里面,一直运算知道被除数等于0为止,输出二进制要从数组里逆序输出。代码:#include using namespace std;int a[100];//数组用来存放余数int main(){ int beichushu,yushu,i=1; while(cin>>beichushu&&beichushu!=0)//多次输入,以0结束程序 { while (beichushu!=0) ... 阅读全文
posted @ 2013-05-21 14:20 同学少年 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Description给出一个不多于5位的整数,要求 1、求出它是几位数 2、分别输出每一位数字 3、按逆序输出各位数字,例如原数为321,应输出123Input一个不大于5位的数字Output三行第一行 位数第二行 用空格分开的每个数字,注意最后一个数字后没有空格第三行 按逆序输出这个数#include using namespace std;int main(){ int n; int a,b,c,d,e; cin>>n; a=n/10000; b=(n-10000*a)/1000; c=(n-10000*a-1000*b)/100; d=(n-1... 阅读全文
posted @ 2013-05-09 21:23 同学少年 阅读(337) 评论(0) 推荐(0) 编辑