Board logo

標題: 2024/06/22 課堂重點(宗儒) [打印本頁]

作者: 鄭繼威    時間: 2024-6-22 12:08     標題: 2024/06/22 課堂重點(宗儒)

2024/06/22 課程重點


上次

[抽考]


[作業]
練習[KitaJudge] 101~110實作並通過AC
https://meet.google.com/rcd-crxn-qmz
作者: 鄭繼威    時間: 2024-6-22 17:04

  1. import java.util.Scanner;

  2. public class b893 {
  3.     static long a,b,c,d,e,f;
  4.     static boolean ans = false;
  5.     public static void main(String[]args){
  6.         Scanner input = new Scanner(System.in);
  7.         while (input.hasNextInt()){
  8.              a = input.nextLong();
  9.              b = input.nextLong();
  10.              c = input.nextLong();
  11.              d = input.nextLong();
  12.              e = input.nextLong();
  13.              f = input.nextLong();
  14.              if (number(-35)*number(35)==0){
  15.                  System.out.println("Too many... = =\"");
  16.                  break;
  17.              }
  18.              result(-35);
  19.              if (!ans){
  20.                  System.out.println("N0THING! >\\\\\\<");
  21.              }

  22.         }
  23.     }
  24.     public static long number(int x){
  25.         return (a*(long)Math.pow(x,5))+ (b*(long)Math.pow(x,4))+(c*(long)Math.pow(x,3))+(d*(long)Math.pow(x,2))+(e*x)+f;
  26.     }
  27.     public static void result (int x){
  28.         if (number(x)==0){//檢查單個數字是不是根
  29.            System.out.printf("%d %d\n",x,x);
  30.            ans= true;
  31.         }
  32.         if (x >=35){
  33.             return;
  34.         }
  35.         if (number(x)*number(x+1)<0){
  36.             System.out.printf("%d %d\n",x,x+1);
  37.             result (x+1);
  38.             ans = true;
  39.         } else {
  40.             result(x+1);
  41.         }
  42.     }
  43. }
複製代碼

作者: 李宗儒    時間: 2024-6-22 17:06

  1. #include<bits/stdc++.h>
  2. using namespace std;

  3. int main()
  4. {
  5.     cin.tie(0);
  6.     cin.sync_with_stdio(0);
  7.     for(int j=0;j<2;j++)
  8.     {
  9.         string a;
  10.         cin>>a;
  11.         for(int i=1;i<a.size();i++)
  12.         {
  13.             cout<<abs(a[i-1]-a[i]);
  14.         }
  15.         cout<<endl;
  16.     }
  17.    
  18.     return 0;
  19. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/) Powered by Discuz! 7.2