結果

問題 No.383 レーティング
ユーザー kurenai3110
提出日時 2017-06-15 00:58:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 431 ms / 2,000 ms
コード長 633 bytes
コンパイル時間 762 ms
コンパイル使用メモリ 64,632 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-24 23:30:54
合計ジャッジ時間 7,675 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

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