herrDeng網內搜尋
自訂搜尋
Ads
訂閱:
張貼留言 (Atom)
熱門文章
-
教育部為提昇全民資安素養與電腦防護能力,本部於101年9月5日至11月5日舉辦「全民資安素養自我評量」活動,請在活動期間內踴躍上網檢測資訊安全素養認知程度,並有機會參與抽獎,詳情請參閱活動網站(網址: https://isafe.moe.edu.tw/event
-
先說明一下這是後知後覺的解答,所謂後知就是股票價格已知存在陣列(清單),當然就要用迴圈練習,雙迴圈暴力解需時O(n**2),當然不用,採python單一迴圈解答「最佳股票的買賣時機#LeetCode 121 Best Time to Buy and Sell Stock」,解...
-
url="https://www.twse.com.tw/exchangeReport/STOCK_DAY?response=json&date=20220330&stockNo=2330"
-
你會用C的算子sizeof?
-
Python CPP heap priority queue速解L eetcode 2530. Maximal Score After Applying K Operations heap/priority queue是重要的資料結構,無論是C++的std::priority_q...
-
C++ DP動態規劃解Leetcode 937 Maximum Number of Points with Cost 有些標示medium要比標示hard的問題還要難,Leetcode 1937. Maximum Number of Points with Cost,DP動態規...
68 則留言:
public class B9933042 {
public static void main(String[] args) {
int[] t={65,70,60,93,70,75,85,60};
int[] c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Sum= "+sum);
System.out.println("Average= "+(sum/cc));
}
}
package P1;
public class B9933052A {
public static void main(String[] args) {
int[] t={73,85,70,85,65,70,90,81};
int[] c={2, 2 ,2 ,3 ,3 ,3 ,3 ,3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Sum= "+sum);
System.out.println("Average= "+(sum/cc));
}
}
package P1;
public class B1 {
public static void main(String[] args) {
int[]t={77,65,76,67,60,88,80,69};
int[]c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum="+sum);
System.out.println("Average="+(sum/cc));
}
}
package Aa;
public class Aa {
public static void main(String[] args) {
int a[]={81,88,94,92,85,77,90,84,92,83};
int b[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=a[i]*b[i];
cc+=b[i];
average=(double)sum/cc;
}
System.out.println("average="+average);
}
}
public class b9933011 {
public static void main(String[] args) {
int[]t={78,78,72,72,60,72,80,46};
int[]c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum="+sum);
System.out.println("Average="+(sum/cc));
}
}
package P1;
public class B9933052A {
public static void main(String[] args) {
int[] t={73,85,70,85,65,70,90,81};
int[] c={2, 2 ,2 ,3 ,3 ,3 ,3 ,3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Sum= "+sum);
System.out.println("Average= "+(sum/cc));
}
}
public class Ex1java {
public static void main(String[] args) {
int[] t={91,85,97,94,95,97,84,87,92,85,93,79};
int[] c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum:"+(float)sum/cc);
}
}
public class b9733054 {
public static void main(String[] args) {
int t[]={80,78,80,65,85,82,60,82,61,69};
int c[]={0,3,1,3,0,2,2,3,3,3};
int sum=0,總學分=0;
int i,avg;
for (i=0;i<10;i++){
sum+=t[i]*c[i];
總學分+=c[i];
}
avg=sum/總學分;
System.out.println("Sum:"+sum);
System.out.println("總學分:"+總學分);
System.out.println("Avg:"+avg);
}
}
package Pack1;
public class B1 {
public static void main(String[] args) {
int t[]={88,74,83,63,70,87,74,86,94,86,92,81};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0,};
int sum=0,cc=0;
for(int i=0; i<t.length; i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Average= "+(float)sum/cc);
}
}
package p1;
public class A1 {
public static void main(String[] args) {
int t[]={76,76,65,67,95,94,60,60,71,80,79,74};
int c[]={0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均:"+(float)sum/cc);
}
}
package Aa;
public class Aa {
public static void main(String[] args) {
int a[]={81,88,94,92,85,77,90,84,92,83};
int b[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=a[i]*b[i];
cc+=b[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
package p1;
public class A1 {
public static void main(String[] args) {
int t[]={82,68,91,78,95,78,38,60,66,71,76,64};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
package pack1;
public class S1 {
public static void main(String[] args) {
int t[]={93,77,83,72,70,83,73,76,90,88,90,80};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Average= "+(float)sum/cc);
}
}
public class B1 {
public static void main(String[] args) {
int t[]={80,84,96,80,80,64,80,90,73,89,73};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum:"+(float)sum/cc);
}
}
package a1;
public class b1 {
public static void main(String[] args) {
int t[]={78,72,70,60,80,61,34,52,74,82,88,72};
int c[]={0,2,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<12;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
public class B9933053 {
public static void main(String[] args) {
int[]t={73,83,60,67,95,84,69,69,85,82,91,70};
int[]c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum:"+(float)sum/cc);
}
}
package A1;
public class A1 {
public static void main(String[] args) {
int t[]={92,94,81,95,90,77,84,94,92,88,81};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
package pack1;
public class B1 {
public static void main(String[] args) {
int t[] ={90,86,73,80,95,93,76,80,94,73,90,77};
int c[] ={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0 ;i<t.length ;i++ )
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Average="+(float)sum/cc);
}
}
int t[]={81,69,87,69,80,99,71,72,92,74,71,73};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum:"+(float)sum/cc);
package p1;
public class A1 {
public static void main(String[] args) {
int t[]={76,76,65,67,95,94,60,60,71,80,79,74};
int c[]={0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均:"+(float)sum/cc);
}
}
package B1;
public class b9933016
{
public static void main(String[] args)
{
int []t={81,71,96,60,85,94,68,73,88,87,92,78};
int []c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++ )
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Average:"+(float)sum/cc);
}
}
package pack1;
public class A1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={81,78,76,82,85,88,72,78,91,85,87,86};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
public class B9933042 {
public static void main(String[] args) {
int[] t={65,70,60,93,70,75,85,60};
int[] c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Sum= "+sum);
System.out.println("Average= "+(double)sum/cc);
}
}
package pack1;
public class A1 {
/**
* @param args
*/
public static void main(String[] args)
{
int t []={79,74,87,74,70,78,74,60,90,72,90,75 };
int c []={0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
package b1;
public class p1 {
public static void main(String[] args) {
int a[]={73,74,62,70,85,71,60,68,85,45,79,74};
int b[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double avg;
for (int i=0;i<10;i++)
{
sum+=a[i]*b[i];
cc+=b[i];
}
avg=(double)sum/cc;
System.out.println("avg="+avg);
}
}
public class b11111{
public static void main(String[] args) {
int t[]={79,74,62,91,82,65,76,56,74,67,73};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
public class b9733054 {
public static void main(String[] args) {
int t[]={80,78,80,65,85,82,60,82,61,69};
int c[]={0,3,1,3,0,2,2,3,3,3};
int sum=0,總學分=0;
int i,avg;
for (i=0;i<10;i++){
sum+=t[i]*c[i];
總學分+=c[i];
}
avg=sum/總學分;
System.out.println("Sum:"+sum);
System.out.println("總學分:"+總學分);
System.out.println("Avg:"+avg);
}
}
public class Ex1java {
public static void main(String[] args) {
int[] t={91,85,97,94,95,97,84,87,92,85,93,79};
int[] c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("average:"+(float)sum/cc);
}
}
public class A1 {
public static void main(String[] args) {
int[]t={94,77,88,90,95,78,65,73,65,73,91,82,90,81};
int[]c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("average:"+(float)sum/cc);
}
}
public class text1
{
public static void main(String[] args)
{
int a[]={82,45,68,61,70,97,60,80,79,63,85,67};
int c[]={ 0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 0};
float avg;
int cc=0;
int sum=0;
for (int i=0;i<a.length;i++)
{
sum+=a[i]*c[i];
cc+=c[i];
}
avg=(float)sum/cc;
System.out.println("加權平均="+avg);
System.out.println("總學分="+cc);
}
}
package pack1;
public class A1 {
public static void main(String[] args) {
// TODO Auto-generated method stub
int t [] = {70,72,60,60,80,40,42,60,66,80,81,61};
int c [] = {0,2,2,2,0,3,3,3,3,3,0,0};
int sum = 0,cc = 0;
for (int i=0 ; i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
public class b9911126 {
public static void main(String[] args) {
int t[]={82,60,75,50,60,51,60,60,50,65,46,85,66};
int c[]={0,3,1,3,4,3,2,1,2,2,2,0,0};
int sum=0,cc=0;
int i,avg;
for ( i=0;i<13;i++)
{sum+=t[i]*c[i];
cc+=c[i];
}
avg=sum/cc;
System.out.println("Sum"+sum);
System.out.println("cc:"+cc);
System.out.println("Avg:"+avg);
}
}
package P1;
public class B1 {
public static void main(String[] args) {
int[]t={77,65,76,67,60,88,80,69};
int[]c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum="+sum);
System.out.println("Average="+(double)sum/cc);
}
}
public class b9933011 {
public static void main(String[] args) {
int[]t={78,78,72,72,60,72,80,46};
int[]c={ 2, 2, 2, 3, 3, 3, 3, 3};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("sum="+sum);
System.out.println("Average="+(double)sum/cc);
}
}
package P1;
public class A {
public static void main(String[] args) {
int[] x = {83,79,76,78,85,92,69,71,72,81,85,82};
int[] y = {0,2,2,2,0,3,3,3,3,3,0,0};
int sum =0 ,yy = 0;
float average ;
for(int i=0; i<11; i++)
{
sum+=x[i]*y[i];
yy+=y[i];
}
average =(float) sum/yy;
System.out.print("average "+ average);
}
}
package P1;
public class B9933052A {
public static void main(String[] args) {
int[] t={73,85,70,85,65,70,90,81};
int[] c={2, 2 ,2 ,3 ,3 ,3 ,3 ,3};
int sum=0,cc=0;
double average;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("Sum= "+sum);
System.out.println("average="+average);
}
}
package pack1;
public class B1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={79,71,60,65,70,62,60,55,84,69,88,70};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
package P1;
public class B9933023 {
public static void main(String[] args) {
int t[]={79,71,68,72,80,50,45,68,83,76,72,64};
int c[]={0,2,2,2,0,3,3,3,3,0,0};
int sum=0,cc=0;
float average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(float)sum/cc;
System.out.println("average="+average);
}
}
public class B9933021
{
public static void main(String[] args)
{
int[] t={81,81,76,75,95,94,64,84,89,88,88,73};
int[] c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0; i<11; i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("average:"+(float)sum/cc);
}
}
public class b11111{
public static void main(String[] args) {
int t[]={81,71,75,76,74,78,96,81,91,73,79};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
package pack;
public class pcak {
public static void main(String[] args) {
int t[]={82,79,74,60,76,82,64,62,53,63,65,73};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
float average;
for (int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(float)sum/cc;
System.out.println("average="+average);
}
}
int t[]={81,69,87,69,80,99,71,72,92,74,71,73};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("avg:"+(float)sum/cc);
package B1;
public class P1 {
public static void main(String[] args) {
int[] t={81,77,86,97,85,87,69,80,90,68,94,78};
int[] c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("Average:"+(float)sum/cc);
}
}
package A1;
public class a1 {
public static void main(String[] args) {
int[] t={86,82,90,79,85,93,60,79,78,81,91,77};
int[] c={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for (int i=0;i<11;i++)
{
sum+=(t[i]*c[i]);
cc+=c[i];
}
System.out.println("Average:"+(float)sum/cc);
}
}
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[] t = { 78, 33, 60, 88, 61, 58, 12 };
int[] c = { 3, 3, 3, 1, 3, 2, 2 };
int sum = 0, cc = 0;
double average;
for (int i = 0; i < 7; i++)
{
sum += t[i] * c[i];
cc += c[i];
}
average = (double)sum / cc;
Console.WriteLine("sum:" + sum);
Console.WriteLine("cc:" + cc);
Console.WriteLine("average:" + average);
Console.ReadLine();
}
}
}
namespace b9733100
{
class Program
{
static void Main(string[] args)
{
int[] t {78,93,47,79,88,83,74,72,92};
int[] c = { 3, 1, 3, 3, 3, 2, 2, 3, 3 };
int sum = 0, cc = 0;
double average;
for (int i = 0; i < 9; i++)
{
sum += t[i] * c[i];
cc += c[i];
}
average = (double)sum / cc;
Console.WriteLine("sum:" + sum);
Console.WriteLine("cc:" + cc);
Console.WriteLine("average:" + average);
Console.ReadLine();
}
}
}
public class b11111{
public static void main(String[] args) {
int t[]={80,97,82,91,85,70,78,72,73,77,84};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
namespace B9733099
{
class Program
{
static void Main(string[] args)
{
int[] t = { 60, 77, 93, 60, 81, 74, 63, 77, 71, 78 };
int[] c = { 3, 3, 1, 3, 3, 3, 0, 2, 2, 3 };
int sum = 0, cc = 0;
double average;
for (int i = 0; i < 10; i++)
{
sum += t[i] * c[i];
cc += c[i];
}
average = (double)sum / cc;
Console.WriteLine("Sum" + sum);
Console.WriteLine("cc:" + cc);
Console.WriteLine("average." + average);
Console.ReadLine();
}
}
}
package PPP1;
public class ggggggidjgidjg {
public static void main(String[] args) {
float average;
int t[]={87,86,71,83,91,97,70,81,67,76,82,70};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(float)sum/cc;
System.out.println("平均="+average);
}
}
package sum;
class sum{
public static void main(String[]args){
int sum = 0;
int a[] = {77,35,63,72,80,80,68,89,85,60,81,72};
int d[] = {0,2,2,2,0,3,3,3,3,3,0,0};
for(int b = 0;b<a.length;b++)
System.out.println(a[b]*d[b]);
for(int b = 0;b<a.length;b++)
sum+=a[b]*d[b];
System.out.println("991下學期加總 = "+sum);
System.out.println("991下學期平均 = "+(float)sum/21);
}
}
public class b11111{
public static void main(String[] args) {
int t[]={82,68,73,81,78,72,71,64,70,72,80};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
package A2;
public class A2 {
public static void main(String[] args) {
int t[]={82,71,61,72,85,75,26,64,87,67,91,80};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double avg;
for (int i=0; i<10; i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
avg=(double)sum/cc;
System.out.println("avg="+avg);
}
}
package pack2;
public class B2 {
public static void main(String[] args) {
int t[]={68,74,77,69,80,71,60,66,82,66,80,60};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("average:"+(float)sum/cc);
}
}
int t[]={82,75,76,86,85,95,75,83,88,91,93,87};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int avg=0,cc=0;
for(int i=0;i<11;i++)
{
avg+=t[i]*c[i];
cc+=c[i];
}
System.out.println("avg:"+(float)avg/cc);
package p1;
public class A1 {
public static void main(String[] args) {
int t[]={82,68,91,78,95,78,38,60,66,71,76,64};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
public class BB0a {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={99,84,83,60,95,90,72,69,75,78,75,71};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc =0;
for(int i=0;i<t.length;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均="+(float)sum/cc);
}
}
package P1;
public class B1 {
public static void main(String[] args) {
int t[]={79,80,94,75,80,92,74,88,89,72,85,70};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("average:"+(float)sum/cc);
}
}
public class B1
{
public static void main(String[] args)
{
int t[]={81,77,80,85,95,93,79,68,84,74,82,79};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0; i<t.length; i++)
System.out.println(t[i]*c[i]);
for(int i=0; i<t.length; i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average =(double) sum / cc;
System.out.println("Sum="+sum);
System.out.println("Average="+average);
}
}
int t[]={81,77,80,71,80,90,78,76,92,77,84,77};
int c[]={0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("avg:"+(float)sum/cc);
public class A2 {
/**
* @param args
*/
public static void main(String[] args)
{
// TODO Auto-generated method stub
int t[] = {78, 80 , 79, 82, 70, 90, 71, 73, 80, 73, 88, 70};
int c[] = {0,2,2,2,0,3,3,3,3,3,0,0};
int sum=0 , cc=0 ;
for ( int i=0 ; i<t.length ; i++ )
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("加權平均"+(float)sum/cc);
}
}
public static void main(String[] args) {
int t1,t2,t3,t4,t5; // 各次的成績
int t6,t7,t8,t9,t10;
int sum; // 總分
float average; // 平均
t1 = 78; t2 = 60; t3 = 70; t4 =93; t5 =60;
t6 = 83; t7 = 84; t8 = 74; t9 = 79; t10 = 87;
sum = t1 + t2 + t3 + t4 + t5 +
t6 + t7 + t8 + t9 + t10; // 計算總分
average = sum / 10; // 計算平均
System.out.println("總分: "+sum); // 顯示總分
System.out.println("平均: "+average);// 顯示平均
public class b9733115 {
public static void main(String[] args) {
int t1,t2,t3,t4,t5; // 各次的成績
int t6,t7,t8,t9,t10;
int sum; // 總分
float average; // 平均
t1 = 66; t2 = 40; t3 = 68; t4 = 70; t5 = 65;
t6 = 70; t7 = 60; t8 = 72; t9 = 76; t10 = 74;
sum = t1 + t2 + t3 + t4 + t5 +
t6 + t7 + t8 + t9 + t10; // 計算總分
average = sum / 10; // 計算平均
System.out.println("總分: "+sum); // 顯示總分
System.out.println("平均: "+average);// 顯示平均
}
}
public class c1 {
public static void main(String[] args) {
int t[]={75,76,60,70,79,75,67,68,65,85,75};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
for(int i=0;i<11;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
System.out.println("avg:"+(float)sum/cc);
}
}
public class b9733115 {
public static void main(String[] args) {
int t1,t2,t3,t4,t5; // 各次的成績
int t6,t7,t8,t9,t10;
int sum; // 總分
float average; // 平均
t1 = 66; t2 = 40; t3 = 68; t4 = 70; t5 = 65;
t6 = 70; t7 = 60; t8 = 72; t9 = 76; t10 = 74;
sum = t1 + t2 + t3 + t4 + t5 +
t6 + t7 + t8 + t9 + t10; // 計算總分
average = sum / 10; // 計算平均
System.out.println("總分: "+sum); // 顯示總分
System.out.println("平均: "+average);// 顯示平均
}
}
package pack1;
public class Ex2
{
public static void main(String[] args)
{
int t[]={85, 85, 85, 92, 95, 91, 73, 99, 87, 92, 92, 69};
int c[]={ 0, 2, 2, 2, 0, 3, 3, 3, 3, 3, 0, 0};
int sum=0;
int sumC=00;
double average;
for(int i=0; i<12; i++)
{
sum+=t[i]*c[i];
sumC+=c[i];
}
average=(double)sum/sumC;
System.out.println("學期加權總成績="+sum);
System.out.println("學期加權平均="+average);
}
}
package p1;
public class t1 {
public static void main(String[] args) {
int t[]={81,94,81,85,75,75,78,94,92,88,81};
int c[]={2,2,2,0,3,3,3,3,3,0,0};
int sum=0,cc=0;
double average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average=(double)sum/cc;
System.out.println("average="+average);
}
}
public class pack1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
// int s[] = new int[3];
// int c[] = new int[3];
int s[]={85,88,90,80,84,95,85,83,82,84};
int c[]={0,2,2,2,3,3,3,3,2,1};
float sum=0;
float cc=0;
float avarage;
for (int i=0;i<=2;i++)
{
sum+=s[i]*c[i];
cc+=c[i];
}
System.out.println(sum);
System.out.println(cc);
avarage=(float)(sum/cc);
System.out.println(avarage);
}
}
public class ava {
public static void main(String[] args) {
// TODO Auto-generated method stub
int t[]={69,65,54,75,74,84,84,74,66,72};
int c[]={3,1,3,3,0,2,2,3,3,3};
int sum=0,cc=0;
float average;
for(int i=0;i<10;i++)
{
sum+=t[i]*c[i];
cc+=c[i];
}
average =(float) sum/cc;
System.out.println("sum:"+sum);
System.out.println("cc:"+cc);
System.out.println("average:"+average);
}
}
張貼留言