1.高考加油的加油加油代码
2.[请教][C编程问题]1000KM路程,车只能装500L油(1L油跑1KM),源码源码用这辆车建立临时加油站的加油加油问题
3.用swing编写一个java抽奖的程序,至少有5个按钮,源码源码显得高大上一点。加油加油
高考加油的源码源码ios系统源码泄漏代码
高考加油的代码如下:#include<iostream>using namespace std;int main(){ cout<<"祝学弟学妹高考:"<<endl; cout<<"旗开得胜"<<endl;cout<<"考的都会,会的加油加油都对"<<endl;cout<<"加油!
扩展资料:
代码就是源码源码程序员用开发工具所支持的语言写出来的源文件,是加油加油一组由字符、符号或信号码元以离散形式表示信息的源码源码明确的规则体系。代码设计的加油加油原则包括唯一确定性、标准化和通用性、源码源码可扩充性与稳定性、加油加油barefoot 源码便于识别与记忆、源码源码力求短小与格式统一以及容易修改等。加油加油
源代码是代码的分支,某种意义上来说,源代码相当于代码。现代程序语言中,dxc源码源代码可以书籍或磁带形式出现,但最为常用格式是文本文件,这种典型格式的目的是为了编译出计算机程序。
计算机源代码最终目的是将人类可读文本翻译成为计算机可执行的二进制指令,这种过程叫编译,它由通过编译器完成。方糖源码
源代码是相对目标代码和可执行代码而言的。源代码就是用汇编语言和高级语言写出来的地代码。目标代码是指源代码经过编译程序产生的能被cpu直接识别二进制代码。可执行代码就是将目标代码连接后形成的可执行文件,当然也是二进制的。
在现代程序语言中,美国源码源代码可以是以书籍或者磁带的形式出现,但最为常用的格式是文本文件,这种典型格式的目的是为了编译出计算机程序。计算机源代码的最终目的是将人类可读的文本翻译成为计算机可以执行的二进制指令,这种过程叫做编译,通过编译器完成。
[请教][C编程问题]KM路程,车只能装L油(1L油跑1KM),用这辆车建立临时加油站的问题
搞定了
算法:
要使消耗的油最少,就要使在建立起来的各各站点之间跑的路最少,建立站点的目的就是要在中间建立一些站点,使车最后一次经过这些站点加油后油箱是满的,并且最后一个站点是在中间,这样就能让车过沙漠了.
我们先来分析一下倒少第二个站点,要使倒数第二个站点与最后一个站点之间的路走的最少,他至少需要走三次,因为建立最后一个站点的时候至少要经过此处两次,最后走的时候会经过一次.也就是说升油可以在这两个站点之前跑3次,那最后一个站点就必须储存/3的油,这样才能保证经过最后一个站点的时候油是满的,同理再分析一下倒数第三个站点和倒数第二个站点至少要跑5次,那倒数第二个站点必须储存/7的油,就这样一直分析下去....直到/3+/7+/9+...>就停止
程序:
#include<stdio.h>
int main()
{
int k=0,i;
float dist=,stat[][2]={ { ,0.5}},sum;
while(dist<)
{
k++;
stat[k][1]=stat[k-1][1]*(1-1.0/(2*k+1));
stat[k][0]=.0/(2*k+1);
dist+=.0/(2*k+1);
}
dist-=.0/(2*k+1);
stat[k][0]=-dist;
for(i=k;i>0;i--)
printf("第%d个站点:距起点%f处加油%f升\n",k-i+1,stat[i][1],stat[i][0]);
printf("总共需要%f升油\n",*k+stat[k][0]*(2*k+1));
return 0;
}
用swing编写一个java抽奖的程序,至少有5个按钮,显得高大上一点。
&#;import java.awt.Color;//界面不是很高大上档次,但是能满足你的基本需求,希望对你有用import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
public class 抽奖游戏 extends JFrame {
static 抽奖游戏 frame;
public 抽奖游戏() {
setLayout(new GridLayout(3, 3, 3, 3));
Border border = new LineBorder(Color.BLUE, 4);
JButton l1 = new JButton();
JButton l2 = new JButton();
JButton l3 = new JButton();
JButton l4 = new JButton();
JButton l5 = new JButton();
JButton l6 = new JButton();
JButton l7 = new JButton("祝你好运");
JButton l8 = new JButton("中奖规则");
JButton l9 = new JButton("再次抽奖");
l1.setBorder(border);
l2.setBorder(border);
l3.setBorder(border);
l4.setBorder(border);
l5.setBorder(border);
l6.setBorder(border);
l7.setBorder(border);
l8.setBorder(border);
l9.setBorder(border);
String[] num2 = { "1", "2", "3", "4", "5", "6" };
l8.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
JOptionPane.showMessageDialog(null, "游戏规则:\n" + "特等奖:\n"
+ "第一行或者第二行出现的数字全部相同\n"
+ "第一第二行出现升序的1,2,3,4,5,6或者降序的6,5,4,3,2,1\n" + "一等奖\n"
+ "1:第一行或第二行的数字降序排列或者升序排列\n"
+ "2:第一行或者第二行相邻的按钮出现一样的数字\n");
}
});
l9.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
l1.setText("*");
l2.setText("*");
l3.setText("*");
l4.setText("*");
l5.setText("*");
l6.setText("*");
l7.setBackground(Color.lightGray);
l7.setText("离中奖不远了!");
}
});
l6.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l5.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l2.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
l1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
// TODO Auto-generated method stub
int j1 = (int) (Math.random() * ) % 6;
l1.setText(num2[j1]);
int j2 = (int) (Math.random() * ) % 6;
l2.setText(num2[j2]);
int j3 = (int) (Math.random() * ) % 6;
l3.setText(num2[j3]);
int j4 = (int) (Math.random() * ) % 6;
l4.setText(num2[j4]);
int j5 = (int) (Math.random() * ) % 6;
l5.setText(num2[j5]);
int j6 = (int) (Math.random() * ) % 6;
l6.setText(num2[j6]);
if (j1 == j2 && j2 == j3 || j4 == j5 && j5 == j6 || j1 == 1
&& j2 == 2 && j3 == 3 && j4 == 4 && j5 == 5 && j6 == 6
|| j1 == 6 && j2 == 5 && j3 == 4 && j4 == 3 && j5 == 2
&& j6 == 1) {
l7.setBackground(Color.red);
l7.setText("特等奖");
} else if (j1 > j2 && j2 > j3 || j3 > j2 && j2 > j1 || j4 > j5
&& j5 > j6 || j6 > j5 && j5 > j4 || j1 == j2
&& j5 == j4 || j1 == j2 && j5 == j6 || j3 == j2
&& j4 == j5 || j5 == j6 && j2 == j3) {
l7.setBackground(Color.YELLOW);
l7.setText("一等奖");
} else {
l7.setBackground(Color.lightGray);
l7.setText("未中奖,加油!");
}
}
});
Font font = new Font("", Font.BOLD, );
l1.setFont(font);
l2.setFont(font);
l3.setFont(font);
l4.setFont(font);
l5.setFont(font);
l6.setFont(font);
l7.setFont(font);
l8.setFont(font);
l9.setFont(font);
add(l1);
add(l2);
add(l3);
add(l4);
add(l5);
add(l6);
add(l7);
add(l8);
add(l9);
}
public static void main(String[] args) {
// TODO Auto-generated method stub
frame = new 抽奖游戏();
frame.setTitle("抽奖大战");
frame.setSize(, );
frame.setLocationRelativeTo(null);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}