結果

問題 No.383 レーティング
ユーザー kurenai3110kurenai3110
提出日時 2017-06-15 00:58:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 432 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 64,940 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 04:05:21
合計ジャッジ時間 7,772 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 430 ms
4,348 KB
testcase_01 AC 430 ms
4,348 KB
testcase_02 AC 430 ms
4,348 KB
testcase_03 AC 429 ms
4,348 KB
testcase_04 AC 429 ms
4,348 KB
testcase_05 AC 430 ms
4,348 KB
testcase_06 AC 429 ms
4,348 KB
testcase_07 AC 430 ms
4,348 KB
testcase_08 AC 431 ms
4,348 KB
testcase_09 AC 430 ms
4,348 KB
testcase_10 AC 430 ms
4,348 KB
testcase_11 AC 429 ms
4,348 KB
testcase_12 AC 432 ms
4,348 KB
testcase_13 AC 430 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;

int main()
{
	double w0 = rand();
	double w1 = rand();
	double w2 = rand();

	for (int i = 0; i < 1e7; i++) {
		double x1 = (double)rand() / RAND_MAX;
		double x2 = (double)rand() / RAND_MAX;
		double y = -x1 + x2;

		double y_pred = w0 + w1*x1 + w2*x2;

		w0 += 1e-4*(y - y_pred);
		w1 += 1e-4*(y - y_pred)*x1;
		w2 += 1e-4*(y - y_pred)*x2;
	}

	double x1, x2, y;
	cin >> x1 >> x2;

	y = w0 + w1*x1 + w2*x2;
	y = round(y);

	if(y)cout << showpos << y << endl;
	else cout << noshowpos << y << endl;

    return 0;
}

0