View Code of Problem 1085

<span style="font-size:18px;">#include<iostream>
using namespace std;
int main()
{
	__int64 n,w,d,sum,ans;
	while(cin>>n>>w>>d>>sum)
	{
		ans=w*n*(n-1)/2;
		if(ans==sum)
		   cout<<n<<endl;
		else
		   cout<<(ans-sum)/d<<endl;
	}
	return 0;
} </span>
/*
F:\temp\16139801.54818\Main.cc:2: error: stray '#' in program
F:\temp\16139801.54818\Main.cc:2: error: expected unqualified-id before '<' token
F:\temp\16139801.54818\Main.cc: In function 'int main()':
F:\temp\16139801.54818\Main.cc:6: error: '__int64' was not declared in this scope
F:\temp\16139801.54818\Main.cc:6: error: expected ';' before 'n'
F:\temp\16139801.54818\Main.cc:7: error: 'cin' was not declared in this scope
F:\temp\16139801.54818\Main.cc:7: error: 'n' was not declared in this scope
F:\temp\16139801.54818\Main.cc:7: error: 'w' was not declared in this scope
F:\temp\16139801.54818\Main.cc:7: error: 'd' was not declared in this scope
F:\temp\16139801.54818\Main.cc:7: error: 'sum' was not declared in this scope
F:\temp\16139801.54818\Main.cc:9: error: 'ans' was not declared in this scope
F:\temp\16139801.54818\Main.cc:11: error: 'cout' was not declared in this scope
F:\temp\16139801.54818\Main.cc:11: error: 'endl' was not declared in this scope
F:\temp\16139801.54818\Main.cc:13: error: 'cout' was not declared in this scope
F:\temp\16139801.54818\Main.cc:13: error: 'endl' was not declared in this scope
F:\temp\16139801.54818\Main.cc: At global scope:
F:\temp\16139801.54818\Main.cc:16: error: expected unqualified-id before '<' token
*/

Double click to view unformatted code.


Back to problem 1085