結果
| 問題 |
No.105 arcの六角ボルト
|
| コンテスト | |
| ユーザー |
RCCW
|
| 提出日時 | 2017-03-04 00:20:10 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 5,000 ms |
| コード長 | 788 bytes |
| コンパイル時間 | 1,626 ms |
| コンパイル使用メモリ | 159,004 KB |
| 実行使用メモリ | 6,812 KB |
| 最終ジャッジ日時 | 2024-06-22 05:56:41 |
| 合計ジャッジ時間 | 2,217 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:39: warning: use of assignment suppression and length modifier together in gnu_scanf format [-Wformat=]
18 | for(i=0;i<5;i++)scanf("%*lf%*lf");
| ^~~~~~~~~~
main.cpp:18:39: warning: use of assignment suppression and length modifier together in gnu_scanf format [-Wformat=]
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
main.cpp:9:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%lf%lf",&x,&y);
| ~~~~~^~~~~~~~~~~~~~~~
main.cpp:18:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
18 | for(i=0;i<5;i++)scanf("%*lf%*lf");
| ~~~~~^~~~~~~~~~~~
ソースコード
#include "bits/stdc++.h"
using namespace std;
int main(){
double x,y,t;
int n,i;
scanf("%d",&n);
while(n--){
scanf("%lf%lf",&x,&y);
//atan2はarctangentといい、位置情報から角度を求められるも。
//この範囲がatan2() 関数は -π から π ラジアン
t=atan2(y,x)/atan(1)*45+180;
//atan2の返り値はラジアンなので、45/atan(1)を掛けて度数法に変換
//さらにその結果は-180~180になっているので180を足して正の値にする
while(t>51)t-=60;
//正しい位置は60の倍数のいずれかなので余りを求める
//この計算は360/6なので60の倍数になる。
for(i=0;i<5;i++)scanf("%*lf%*lf");
//残りの5つのデータは要らないので捨てる
printf("%f\n",t);
}
return 0;
}
RCCW