Не могу понять что не так в коде выдает ошибку NullReferenceException: Object reference not set to an instance of an object main.Update () (at Assets/Skripts/main.cs:34) вот сам код using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; public class main : MonoBehaviour { public double money = 0.000f; public float moneyperclick = 0.001f; public float moneypersecond = 0.000f; public float timer = 1.0f; private float lasttimer; //BOOSTERS public Button fstBoostButton; public Text fstboostertext; public float fstboosterprice = 0.001f; public Text textmoney; // Start is called before the first frame update void Start() { lasttimer = timer; } // Update is called once per frame void Update() { if (money = fstboosterprice) { money -= fstboosterprice; fstboosterprice *= 2; moneypersecond += 0.002f; } } }
#include <iostream>
typedef long long ll;
using namespace std;
bool ll_is_valid(ll t, ll N, ll x, ll y)
{
return t / x + (t - x) / y >= N;
}
ll f(ll N, ll x, ll y)
{
ll R = 1;
while (!ll_is_valid(R,N,x,y)) R *= 2;
ll L = R / 2;
while(R - L > 1)
{
ll M = (L + R) / 2;
if (!ll_is_valid(M,N,x,y)) {L = M;}
else {R = M;}
}
return R;
}
int main()
{
ll N,x,y;
cin >> N >> x >> y;
if(x > y) swap( x, y );
cout << f(N, x, y) << std::endl;
}