提出 #62052238


ソースコード 拡げる

Copy
#include<bits/stdc++.h>
using namespace std;
int main(){
int N,A[110],i,j,ans;
float h;
ans=1;
cin>>N;
for(i=0;i<N;i++){
cin>>A[i];
}
h=float(A[1]/A[0]);
for(i=1;i<N-1;i++){
if(float(A[i+1]/A[i])!=h){
ans=0;
}
}
if(ans==0){
cout<<"No";
}else{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<bits/stdc++.h>
using namespace std;

int main(){
  int N,A[110],i,j,ans;
  float h;
  ans=1;
  cin>>N;
  for(i=0;i<N;i++){
    cin>>A[i];
  }
  h=float(A[1]/A[0]);
  for(i=1;i<N-1;i++){
    if(float(A[i+1]/A[i])!=h){
      ans=0;
    }
  }
  if(ans==0){
    cout<<"No";
    
  }else{
    cout<<"Yes";
  }
}

提出情報

提出日時
問題 B - Geometric Sequence
ユーザ taroki
言語 C++ 17 (gcc 12.2)
得点 0
コード長 338 Byte
結果 WA
実行時間 1 ms
メモリ 3664 KB

コンパイルエラー

Main.cpp: In function ‘int main()’:
Main.cpp:5:18: warning: unused variable ‘j’ [-Wunused-variable]
    5 |   int N,A[110],i,j,ans;
      |                  ^

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 0 / 200
結果
AC × 3
AC × 22
WA × 8
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3532 KB
example_01.txt AC 1 ms 3476 KB
example_02.txt AC 1 ms 3472 KB
hand_00.txt AC 1 ms 3480 KB
hand_01.txt WA 1 ms 3480 KB
hand_02.txt AC 1 ms 3448 KB
hand_03.txt WA 1 ms 3476 KB
hand_04.txt AC 1 ms 3612 KB
hand_05.txt AC 1 ms 3472 KB
hand_06.txt AC 1 ms 3532 KB
hand_07.txt AC 1 ms 3596 KB
hand_08.txt AC 1 ms 3540 KB
hand_09.txt WA 1 ms 3472 KB
hand_10.txt AC 1 ms 3664 KB
hand_11.txt WA 1 ms 3540 KB
random_00.txt AC 1 ms 3484 KB
random_01.txt AC 1 ms 3616 KB
random_02.txt AC 1 ms 3612 KB
random_03.txt WA 1 ms 3528 KB
random_04.txt AC 1 ms 3516 KB
random_05.txt AC 1 ms 3516 KB
random_06.txt WA 1 ms 3448 KB
random_07.txt AC 1 ms 3596 KB
random_08.txt AC 1 ms 3528 KB
random_09.txt WA 1 ms 3480 KB
random_10.txt AC 1 ms 3488 KB
random_11.txt AC 1 ms 3532 KB
random_12.txt WA 1 ms 3468 KB
random_13.txt AC 1 ms 3484 KB
random_14.txt AC 1 ms 3644 KB


2025-04-09 (水)
07:24:07 +00:00