谁能写出这个程序?大家一起来写写啊。。。。

Spreadsheet is nowadays used widely in daily business. The following figure illustrates a spreadsheet application. 



One of the most useful features of it is that we can specify formulae in the cells. For example, the formula in B1 cell references other two cells, and its value is calculated from them. The value of B1 cell in above spreadsheet is 89 (B3) - 9 + -34 (C2) = 46. The calculation is easy and straightforward.
However, there might be cases where the values of some cells can’t be evaluated. For example, the spreadsheet illustrated below has some problem with cell value evaluation.





Cell B1 and C2 reference and depend on each other thus they can’t be evaluated. Now given an arbitrary spreadsheet, can we determine if all its cells can be evaluated programmatically?


Your task
1) Please write a function to determine whether all the cells in the spreadsheet can be evaluated.  The signature of this function is like following –

  • C/C++: int Spreadsheet()
  • Java: int Spreadsheet()
  • C#: int Spreadsheet()

If all the cells can be evaluated successfully, return a non-zero integer. Otherwise, return 0. You are given 3 functions that you can use –

  • int GetRowCount(); // returns the number of rows of the spreadsheet
  • int GetColumnCount(); // returns the number of columns of the spreadsheet
  • char* GetCell(int row, char column); // returns the content in string representation of the cell. Note, for Java and C# the return type is string and String respectively.


NOTE –

  • The index of row number of each cell starts at 0. There’ll be at most 50 rows in total.
  • The representations of column numbers are alphabetical letters, starting from ‘A’ to ‘Z’. That is also to say there’ll be at most 26 columns in total.
  • For cells that have formulae, as illustrated above, they start with ‘=’. There’ll be only ‘+’ and ‘-‘ operators in each formula.

你可能感兴趣的:(谁能写出这个程序?大家一起来写写啊。。。。)